
obj/user/testfdsharing.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 9d 01 00 00       	call   8001ce <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:

char buf[512], buf2[512];

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	57                   	push   %edi
  80003b:	56                   	push   %esi
  80003c:	53                   	push   %ebx
  80003d:	83 ec 14             	sub    $0x14,%esp
	int fd, r, n, n2;

	if ((fd = open("motd", O_RDONLY)) < 0)
  800040:	6a 00                	push   $0x0
  800042:	68 a0 24 80 00       	push   $0x8024a0
  800047:	e8 e5 19 00 00       	call   801a31 <open>
  80004c:	89 c3                	mov    %eax,%ebx
  80004e:	83 c4 10             	add    $0x10,%esp
  800051:	85 c0                	test   %eax,%eax
  800053:	0f 88 ff 00 00 00    	js     800158 <umain+0x125>
		panic("open motd: %e", fd);
	seek(fd, 0);
  800059:	83 ec 08             	sub    $0x8,%esp
  80005c:	6a 00                	push   $0x0
  80005e:	50                   	push   %eax
  80005f:	e8 94 16 00 00       	call   8016f8 <seek>
	if ((n = readn(fd, buf, sizeof buf)) <= 0)
  800064:	83 c4 0c             	add    $0xc,%esp
  800067:	68 00 02 00 00       	push   $0x200
  80006c:	68 20 42 80 00       	push   $0x804220
  800071:	53                   	push   %ebx
  800072:	e8 b0 15 00 00       	call   801627 <readn>
  800077:	89 c6                	mov    %eax,%esi
  800079:	83 c4 10             	add    $0x10,%esp
  80007c:	85 c0                	test   %eax,%eax
  80007e:	0f 8e e6 00 00 00    	jle    80016a <umain+0x137>
		panic("readn: %e", n);

	if ((r = fork()) < 0)
  800084:	e8 f0 0f 00 00       	call   801079 <fork>
  800089:	89 c7                	mov    %eax,%edi
  80008b:	85 c0                	test   %eax,%eax
  80008d:	0f 88 e9 00 00 00    	js     80017c <umain+0x149>
		panic("fork: %e", r);
	if (r == 0) {
  800093:	75 7b                	jne    800110 <umain+0xdd>
		seek(fd, 0);
  800095:	83 ec 08             	sub    $0x8,%esp
  800098:	6a 00                	push   $0x0
  80009a:	53                   	push   %ebx
  80009b:	e8 58 16 00 00       	call   8016f8 <seek>
		cprintf("going to read in child (might page fault if your sharing is buggy)\n");
  8000a0:	c7 04 24 10 25 80 00 	movl   $0x802510,(%esp)
  8000a7:	e8 7b 02 00 00       	call   800327 <cprintf>
		if ((n2 = readn(fd, buf2, sizeof buf2)) != n)
  8000ac:	83 c4 0c             	add    $0xc,%esp
  8000af:	68 00 02 00 00       	push   $0x200
  8000b4:	68 20 40 80 00       	push   $0x804020
  8000b9:	53                   	push   %ebx
  8000ba:	e8 68 15 00 00       	call   801627 <readn>
  8000bf:	83 c4 10             	add    $0x10,%esp
  8000c2:	39 c6                	cmp    %eax,%esi
  8000c4:	0f 85 c4 00 00 00    	jne    80018e <umain+0x15b>
			panic("read in parent got %d, read in child got %d", n, n2);
		if (memcmp(buf, buf2, n) != 0)
  8000ca:	83 ec 04             	sub    $0x4,%esp
  8000cd:	56                   	push   %esi
  8000ce:	68 20 40 80 00       	push   $0x804020
  8000d3:	68 20 42 80 00       	push   $0x804220
  8000d8:	e8 59 0a 00 00       	call   800b36 <memcmp>
  8000dd:	83 c4 10             	add    $0x10,%esp
  8000e0:	85 c0                	test   %eax,%eax
  8000e2:	0f 85 bc 00 00 00    	jne    8001a4 <umain+0x171>
			panic("read in parent got different bytes from read in child");
		cprintf("read in child succeeded\n");
  8000e8:	83 ec 0c             	sub    $0xc,%esp
  8000eb:	68 db 24 80 00       	push   $0x8024db
  8000f0:	e8 32 02 00 00       	call   800327 <cprintf>
		seek(fd, 0);
  8000f5:	83 c4 08             	add    $0x8,%esp
  8000f8:	6a 00                	push   $0x0
  8000fa:	53                   	push   %ebx
  8000fb:	e8 f8 15 00 00       	call   8016f8 <seek>
		close(fd);
  800100:	89 1c 24             	mov    %ebx,(%esp)
  800103:	e8 4a 13 00 00       	call   801452 <close>
		exit();
  800108:	e8 15 01 00 00       	call   800222 <exit>
  80010d:	83 c4 10             	add    $0x10,%esp
	}
	wait(r);
  800110:	83 ec 0c             	sub    $0xc,%esp
  800113:	57                   	push   %edi
  800114:	e8 2b 1d 00 00       	call   801e44 <wait>
	if ((n2 = readn(fd, buf2, sizeof buf2)) != n)
  800119:	83 c4 0c             	add    $0xc,%esp
  80011c:	68 00 02 00 00       	push   $0x200
  800121:	68 20 40 80 00       	push   $0x804020
  800126:	53                   	push   %ebx
  800127:	e8 fb 14 00 00       	call   801627 <readn>
  80012c:	83 c4 10             	add    $0x10,%esp
  80012f:	39 c6                	cmp    %eax,%esi
  800131:	0f 85 81 00 00 00    	jne    8001b8 <umain+0x185>
		panic("read in parent got %d, then got %d", n, n2);
	cprintf("read in parent succeeded\n");
  800137:	83 ec 0c             	sub    $0xc,%esp
  80013a:	68 f4 24 80 00       	push   $0x8024f4
  80013f:	e8 e3 01 00 00       	call   800327 <cprintf>
	close(fd);
  800144:	89 1c 24             	mov    %ebx,(%esp)
  800147:	e8 06 13 00 00       	call   801452 <close>
#include <inc/types.h>

static inline void
breakpoint(void)
{
	asm volatile("int3");
  80014c:	cc                   	int3   

	breakpoint();
}
  80014d:	83 c4 10             	add    $0x10,%esp
  800150:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800153:	5b                   	pop    %ebx
  800154:	5e                   	pop    %esi
  800155:	5f                   	pop    %edi
  800156:	5d                   	pop    %ebp
  800157:	c3                   	ret    
		panic("open motd: %e", fd);
  800158:	50                   	push   %eax
  800159:	68 a5 24 80 00       	push   $0x8024a5
  80015e:	6a 0c                	push   $0xc
  800160:	68 b3 24 80 00       	push   $0x8024b3
  800165:	e8 d6 00 00 00       	call   800240 <_panic>
		panic("readn: %e", n);
  80016a:	50                   	push   %eax
  80016b:	68 c8 24 80 00       	push   $0x8024c8
  800170:	6a 0f                	push   $0xf
  800172:	68 b3 24 80 00       	push   $0x8024b3
  800177:	e8 c4 00 00 00       	call   800240 <_panic>
		panic("fork: %e", r);
  80017c:	50                   	push   %eax
  80017d:	68 d2 24 80 00       	push   $0x8024d2
  800182:	6a 12                	push   $0x12
  800184:	68 b3 24 80 00       	push   $0x8024b3
  800189:	e8 b2 00 00 00       	call   800240 <_panic>
			panic("read in parent got %d, read in child got %d", n, n2);
  80018e:	83 ec 0c             	sub    $0xc,%esp
  800191:	50                   	push   %eax
  800192:	56                   	push   %esi
  800193:	68 54 25 80 00       	push   $0x802554
  800198:	6a 17                	push   $0x17
  80019a:	68 b3 24 80 00       	push   $0x8024b3
  80019f:	e8 9c 00 00 00       	call   800240 <_panic>
			panic("read in parent got different bytes from read in child");
  8001a4:	83 ec 04             	sub    $0x4,%esp
  8001a7:	68 80 25 80 00       	push   $0x802580
  8001ac:	6a 19                	push   $0x19
  8001ae:	68 b3 24 80 00       	push   $0x8024b3
  8001b3:	e8 88 00 00 00       	call   800240 <_panic>
		panic("read in parent got %d, then got %d", n, n2);
  8001b8:	83 ec 0c             	sub    $0xc,%esp
  8001bb:	50                   	push   %eax
  8001bc:	56                   	push   %esi
  8001bd:	68 b8 25 80 00       	push   $0x8025b8
  8001c2:	6a 21                	push   $0x21
  8001c4:	68 b3 24 80 00       	push   $0x8024b3
  8001c9:	e8 72 00 00 00       	call   800240 <_panic>

008001ce <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8001ce:	f3 0f 1e fb          	endbr32 
  8001d2:	55                   	push   %ebp
  8001d3:	89 e5                	mov    %esp,%ebp
  8001d5:	56                   	push   %esi
  8001d6:	53                   	push   %ebx
  8001d7:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8001da:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8001dd:	c7 05 20 44 80 00 00 	movl   $0x0,0x804420
  8001e4:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8001e7:	e8 10 0b 00 00       	call   800cfc <sys_getenvid>
  8001ec:	25 ff 03 00 00       	and    $0x3ff,%eax
  8001f1:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8001f4:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8001f9:	a3 20 44 80 00       	mov    %eax,0x804420

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8001fe:	85 db                	test   %ebx,%ebx
  800200:	7e 07                	jle    800209 <libmain+0x3b>
		binaryname = argv[0];
  800202:	8b 06                	mov    (%esi),%eax
  800204:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  800209:	83 ec 08             	sub    $0x8,%esp
  80020c:	56                   	push   %esi
  80020d:	53                   	push   %ebx
  80020e:	e8 20 fe ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  800213:	e8 0a 00 00 00       	call   800222 <exit>
}
  800218:	83 c4 10             	add    $0x10,%esp
  80021b:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80021e:	5b                   	pop    %ebx
  80021f:	5e                   	pop    %esi
  800220:	5d                   	pop    %ebp
  800221:	c3                   	ret    

00800222 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  800222:	f3 0f 1e fb          	endbr32 
  800226:	55                   	push   %ebp
  800227:	89 e5                	mov    %esp,%ebp
  800229:	83 ec 08             	sub    $0x8,%esp
	close_all();
  80022c:	e8 52 12 00 00       	call   801483 <close_all>
	sys_env_destroy(0);
  800231:	83 ec 0c             	sub    $0xc,%esp
  800234:	6a 00                	push   $0x0
  800236:	e8 7c 0a 00 00       	call   800cb7 <sys_env_destroy>
}
  80023b:	83 c4 10             	add    $0x10,%esp
  80023e:	c9                   	leave  
  80023f:	c3                   	ret    

00800240 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  800240:	f3 0f 1e fb          	endbr32 
  800244:	55                   	push   %ebp
  800245:	89 e5                	mov    %esp,%ebp
  800247:	56                   	push   %esi
  800248:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  800249:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  80024c:	8b 35 00 30 80 00    	mov    0x803000,%esi
  800252:	e8 a5 0a 00 00       	call   800cfc <sys_getenvid>
  800257:	83 ec 0c             	sub    $0xc,%esp
  80025a:	ff 75 0c             	pushl  0xc(%ebp)
  80025d:	ff 75 08             	pushl  0x8(%ebp)
  800260:	56                   	push   %esi
  800261:	50                   	push   %eax
  800262:	68 e8 25 80 00       	push   $0x8025e8
  800267:	e8 bb 00 00 00       	call   800327 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  80026c:	83 c4 18             	add    $0x18,%esp
  80026f:	53                   	push   %ebx
  800270:	ff 75 10             	pushl  0x10(%ebp)
  800273:	e8 5a 00 00 00       	call   8002d2 <vcprintf>
	cprintf("\n");
  800278:	c7 04 24 f2 24 80 00 	movl   $0x8024f2,(%esp)
  80027f:	e8 a3 00 00 00       	call   800327 <cprintf>
  800284:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  800287:	cc                   	int3   
  800288:	eb fd                	jmp    800287 <_panic+0x47>

0080028a <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  80028a:	f3 0f 1e fb          	endbr32 
  80028e:	55                   	push   %ebp
  80028f:	89 e5                	mov    %esp,%ebp
  800291:	53                   	push   %ebx
  800292:	83 ec 04             	sub    $0x4,%esp
  800295:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800298:	8b 13                	mov    (%ebx),%edx
  80029a:	8d 42 01             	lea    0x1(%edx),%eax
  80029d:	89 03                	mov    %eax,(%ebx)
  80029f:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8002a2:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  8002a6:	3d ff 00 00 00       	cmp    $0xff,%eax
  8002ab:	74 09                	je     8002b6 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  8002ad:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8002b1:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8002b4:	c9                   	leave  
  8002b5:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8002b6:	83 ec 08             	sub    $0x8,%esp
  8002b9:	68 ff 00 00 00       	push   $0xff
  8002be:	8d 43 08             	lea    0x8(%ebx),%eax
  8002c1:	50                   	push   %eax
  8002c2:	e8 ab 09 00 00       	call   800c72 <sys_cputs>
		b->idx = 0;
  8002c7:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8002cd:	83 c4 10             	add    $0x10,%esp
  8002d0:	eb db                	jmp    8002ad <putch+0x23>

008002d2 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8002d2:	f3 0f 1e fb          	endbr32 
  8002d6:	55                   	push   %ebp
  8002d7:	89 e5                	mov    %esp,%ebp
  8002d9:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  8002df:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8002e6:	00 00 00 
	b.cnt = 0;
  8002e9:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8002f0:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8002f3:	ff 75 0c             	pushl  0xc(%ebp)
  8002f6:	ff 75 08             	pushl  0x8(%ebp)
  8002f9:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8002ff:	50                   	push   %eax
  800300:	68 8a 02 80 00       	push   $0x80028a
  800305:	e8 20 01 00 00       	call   80042a <vprintfmt>
	sys_cputs(b.buf, b.idx);
  80030a:	83 c4 08             	add    $0x8,%esp
  80030d:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  800313:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  800319:	50                   	push   %eax
  80031a:	e8 53 09 00 00       	call   800c72 <sys_cputs>

	return b.cnt;
}
  80031f:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  800325:	c9                   	leave  
  800326:	c3                   	ret    

00800327 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  800327:	f3 0f 1e fb          	endbr32 
  80032b:	55                   	push   %ebp
  80032c:	89 e5                	mov    %esp,%ebp
  80032e:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  800331:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  800334:	50                   	push   %eax
  800335:	ff 75 08             	pushl  0x8(%ebp)
  800338:	e8 95 ff ff ff       	call   8002d2 <vcprintf>
	va_end(ap);

	return cnt;
}
  80033d:	c9                   	leave  
  80033e:	c3                   	ret    

0080033f <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  80033f:	55                   	push   %ebp
  800340:	89 e5                	mov    %esp,%ebp
  800342:	57                   	push   %edi
  800343:	56                   	push   %esi
  800344:	53                   	push   %ebx
  800345:	83 ec 1c             	sub    $0x1c,%esp
  800348:	89 c7                	mov    %eax,%edi
  80034a:	89 d6                	mov    %edx,%esi
  80034c:	8b 45 08             	mov    0x8(%ebp),%eax
  80034f:	8b 55 0c             	mov    0xc(%ebp),%edx
  800352:	89 d1                	mov    %edx,%ecx
  800354:	89 c2                	mov    %eax,%edx
  800356:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800359:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80035c:	8b 45 10             	mov    0x10(%ebp),%eax
  80035f:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800362:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800365:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  80036c:	39 c2                	cmp    %eax,%edx
  80036e:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800371:	72 3e                	jb     8003b1 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800373:	83 ec 0c             	sub    $0xc,%esp
  800376:	ff 75 18             	pushl  0x18(%ebp)
  800379:	83 eb 01             	sub    $0x1,%ebx
  80037c:	53                   	push   %ebx
  80037d:	50                   	push   %eax
  80037e:	83 ec 08             	sub    $0x8,%esp
  800381:	ff 75 e4             	pushl  -0x1c(%ebp)
  800384:	ff 75 e0             	pushl  -0x20(%ebp)
  800387:	ff 75 dc             	pushl  -0x24(%ebp)
  80038a:	ff 75 d8             	pushl  -0x28(%ebp)
  80038d:	e8 9e 1e 00 00       	call   802230 <__udivdi3>
  800392:	83 c4 18             	add    $0x18,%esp
  800395:	52                   	push   %edx
  800396:	50                   	push   %eax
  800397:	89 f2                	mov    %esi,%edx
  800399:	89 f8                	mov    %edi,%eax
  80039b:	e8 9f ff ff ff       	call   80033f <printnum>
  8003a0:	83 c4 20             	add    $0x20,%esp
  8003a3:	eb 13                	jmp    8003b8 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  8003a5:	83 ec 08             	sub    $0x8,%esp
  8003a8:	56                   	push   %esi
  8003a9:	ff 75 18             	pushl  0x18(%ebp)
  8003ac:	ff d7                	call   *%edi
  8003ae:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8003b1:	83 eb 01             	sub    $0x1,%ebx
  8003b4:	85 db                	test   %ebx,%ebx
  8003b6:	7f ed                	jg     8003a5 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8003b8:	83 ec 08             	sub    $0x8,%esp
  8003bb:	56                   	push   %esi
  8003bc:	83 ec 04             	sub    $0x4,%esp
  8003bf:	ff 75 e4             	pushl  -0x1c(%ebp)
  8003c2:	ff 75 e0             	pushl  -0x20(%ebp)
  8003c5:	ff 75 dc             	pushl  -0x24(%ebp)
  8003c8:	ff 75 d8             	pushl  -0x28(%ebp)
  8003cb:	e8 70 1f 00 00       	call   802340 <__umoddi3>
  8003d0:	83 c4 14             	add    $0x14,%esp
  8003d3:	0f be 80 0b 26 80 00 	movsbl 0x80260b(%eax),%eax
  8003da:	50                   	push   %eax
  8003db:	ff d7                	call   *%edi
}
  8003dd:	83 c4 10             	add    $0x10,%esp
  8003e0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8003e3:	5b                   	pop    %ebx
  8003e4:	5e                   	pop    %esi
  8003e5:	5f                   	pop    %edi
  8003e6:	5d                   	pop    %ebp
  8003e7:	c3                   	ret    

008003e8 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8003e8:	f3 0f 1e fb          	endbr32 
  8003ec:	55                   	push   %ebp
  8003ed:	89 e5                	mov    %esp,%ebp
  8003ef:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8003f2:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8003f6:	8b 10                	mov    (%eax),%edx
  8003f8:	3b 50 04             	cmp    0x4(%eax),%edx
  8003fb:	73 0a                	jae    800407 <sprintputch+0x1f>
		*b->buf++ = ch;
  8003fd:	8d 4a 01             	lea    0x1(%edx),%ecx
  800400:	89 08                	mov    %ecx,(%eax)
  800402:	8b 45 08             	mov    0x8(%ebp),%eax
  800405:	88 02                	mov    %al,(%edx)
}
  800407:	5d                   	pop    %ebp
  800408:	c3                   	ret    

00800409 <printfmt>:
{
  800409:	f3 0f 1e fb          	endbr32 
  80040d:	55                   	push   %ebp
  80040e:	89 e5                	mov    %esp,%ebp
  800410:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  800413:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  800416:	50                   	push   %eax
  800417:	ff 75 10             	pushl  0x10(%ebp)
  80041a:	ff 75 0c             	pushl  0xc(%ebp)
  80041d:	ff 75 08             	pushl  0x8(%ebp)
  800420:	e8 05 00 00 00       	call   80042a <vprintfmt>
}
  800425:	83 c4 10             	add    $0x10,%esp
  800428:	c9                   	leave  
  800429:	c3                   	ret    

0080042a <vprintfmt>:
{
  80042a:	f3 0f 1e fb          	endbr32 
  80042e:	55                   	push   %ebp
  80042f:	89 e5                	mov    %esp,%ebp
  800431:	57                   	push   %edi
  800432:	56                   	push   %esi
  800433:	53                   	push   %ebx
  800434:	83 ec 3c             	sub    $0x3c,%esp
  800437:	8b 75 08             	mov    0x8(%ebp),%esi
  80043a:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  80043d:	8b 7d 10             	mov    0x10(%ebp),%edi
  800440:	e9 5d 03 00 00       	jmp    8007a2 <vprintfmt+0x378>
		padc = ' ';
  800445:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800449:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800450:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800457:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  80045e:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800463:	8d 47 01             	lea    0x1(%edi),%eax
  800466:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800469:	0f b6 17             	movzbl (%edi),%edx
  80046c:	8d 42 dd             	lea    -0x23(%edx),%eax
  80046f:	3c 55                	cmp    $0x55,%al
  800471:	0f 87 ae 03 00 00    	ja     800825 <vprintfmt+0x3fb>
  800477:	0f b6 c0             	movzbl %al,%eax
  80047a:	3e ff 24 85 40 27 80 	notrack jmp *0x802740(,%eax,4)
  800481:	00 
  800482:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800485:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800489:	eb d8                	jmp    800463 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80048b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80048e:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800492:	eb cf                	jmp    800463 <vprintfmt+0x39>
  800494:	0f b6 d2             	movzbl %dl,%edx
  800497:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  80049a:	b8 00 00 00 00       	mov    $0x0,%eax
  80049f:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  8004a2:	8d 04 80             	lea    (%eax,%eax,4),%eax
  8004a5:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  8004a9:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  8004ac:	8d 4a d0             	lea    -0x30(%edx),%ecx
  8004af:	83 f9 09             	cmp    $0x9,%ecx
  8004b2:	77 55                	ja     800509 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8004b4:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8004b7:	eb e9                	jmp    8004a2 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8004b9:	8b 45 14             	mov    0x14(%ebp),%eax
  8004bc:	8b 00                	mov    (%eax),%eax
  8004be:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8004c1:	8b 45 14             	mov    0x14(%ebp),%eax
  8004c4:	8d 40 04             	lea    0x4(%eax),%eax
  8004c7:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8004ca:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8004cd:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8004d1:	79 90                	jns    800463 <vprintfmt+0x39>
				width = precision, precision = -1;
  8004d3:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8004d6:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8004d9:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  8004e0:	eb 81                	jmp    800463 <vprintfmt+0x39>
  8004e2:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8004e5:	85 c0                	test   %eax,%eax
  8004e7:	ba 00 00 00 00       	mov    $0x0,%edx
  8004ec:	0f 49 d0             	cmovns %eax,%edx
  8004ef:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8004f2:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8004f5:	e9 69 ff ff ff       	jmp    800463 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8004fa:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8004fd:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  800504:	e9 5a ff ff ff       	jmp    800463 <vprintfmt+0x39>
  800509:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  80050c:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80050f:	eb bc                	jmp    8004cd <vprintfmt+0xa3>
			lflag++;
  800511:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800514:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800517:	e9 47 ff ff ff       	jmp    800463 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  80051c:	8b 45 14             	mov    0x14(%ebp),%eax
  80051f:	8d 78 04             	lea    0x4(%eax),%edi
  800522:	83 ec 08             	sub    $0x8,%esp
  800525:	53                   	push   %ebx
  800526:	ff 30                	pushl  (%eax)
  800528:	ff d6                	call   *%esi
			break;
  80052a:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  80052d:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  800530:	e9 6a 02 00 00       	jmp    80079f <vprintfmt+0x375>
			err = va_arg(ap, int);
  800535:	8b 45 14             	mov    0x14(%ebp),%eax
  800538:	8d 78 04             	lea    0x4(%eax),%edi
  80053b:	8b 00                	mov    (%eax),%eax
  80053d:	99                   	cltd   
  80053e:	31 d0                	xor    %edx,%eax
  800540:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  800542:	83 f8 0f             	cmp    $0xf,%eax
  800545:	7f 23                	jg     80056a <vprintfmt+0x140>
  800547:	8b 14 85 a0 28 80 00 	mov    0x8028a0(,%eax,4),%edx
  80054e:	85 d2                	test   %edx,%edx
  800550:	74 18                	je     80056a <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800552:	52                   	push   %edx
  800553:	68 21 2b 80 00       	push   $0x802b21
  800558:	53                   	push   %ebx
  800559:	56                   	push   %esi
  80055a:	e8 aa fe ff ff       	call   800409 <printfmt>
  80055f:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800562:	89 7d 14             	mov    %edi,0x14(%ebp)
  800565:	e9 35 02 00 00       	jmp    80079f <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  80056a:	50                   	push   %eax
  80056b:	68 23 26 80 00       	push   $0x802623
  800570:	53                   	push   %ebx
  800571:	56                   	push   %esi
  800572:	e8 92 fe ff ff       	call   800409 <printfmt>
  800577:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80057a:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  80057d:	e9 1d 02 00 00       	jmp    80079f <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800582:	8b 45 14             	mov    0x14(%ebp),%eax
  800585:	83 c0 04             	add    $0x4,%eax
  800588:	89 45 c8             	mov    %eax,-0x38(%ebp)
  80058b:	8b 45 14             	mov    0x14(%ebp),%eax
  80058e:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800590:	85 d2                	test   %edx,%edx
  800592:	b8 1c 26 80 00       	mov    $0x80261c,%eax
  800597:	0f 45 c2             	cmovne %edx,%eax
  80059a:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  80059d:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8005a1:	7e 06                	jle    8005a9 <vprintfmt+0x17f>
  8005a3:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  8005a7:	75 0d                	jne    8005b6 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  8005a9:	8b 45 cc             	mov    -0x34(%ebp),%eax
  8005ac:	89 c7                	mov    %eax,%edi
  8005ae:	03 45 d4             	add    -0x2c(%ebp),%eax
  8005b1:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8005b4:	eb 55                	jmp    80060b <vprintfmt+0x1e1>
  8005b6:	83 ec 08             	sub    $0x8,%esp
  8005b9:	ff 75 d8             	pushl  -0x28(%ebp)
  8005bc:	ff 75 cc             	pushl  -0x34(%ebp)
  8005bf:	e8 15 03 00 00       	call   8008d9 <strnlen>
  8005c4:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8005c7:	29 c2                	sub    %eax,%edx
  8005c9:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8005cc:	83 c4 10             	add    $0x10,%esp
  8005cf:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8005d1:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8005d5:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8005d8:	85 ff                	test   %edi,%edi
  8005da:	7e 11                	jle    8005ed <vprintfmt+0x1c3>
					putch(padc, putdat);
  8005dc:	83 ec 08             	sub    $0x8,%esp
  8005df:	53                   	push   %ebx
  8005e0:	ff 75 d4             	pushl  -0x2c(%ebp)
  8005e3:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  8005e5:	83 ef 01             	sub    $0x1,%edi
  8005e8:	83 c4 10             	add    $0x10,%esp
  8005eb:	eb eb                	jmp    8005d8 <vprintfmt+0x1ae>
  8005ed:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8005f0:	85 d2                	test   %edx,%edx
  8005f2:	b8 00 00 00 00       	mov    $0x0,%eax
  8005f7:	0f 49 c2             	cmovns %edx,%eax
  8005fa:	29 c2                	sub    %eax,%edx
  8005fc:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8005ff:	eb a8                	jmp    8005a9 <vprintfmt+0x17f>
					putch(ch, putdat);
  800601:	83 ec 08             	sub    $0x8,%esp
  800604:	53                   	push   %ebx
  800605:	52                   	push   %edx
  800606:	ff d6                	call   *%esi
  800608:	83 c4 10             	add    $0x10,%esp
  80060b:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  80060e:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800610:	83 c7 01             	add    $0x1,%edi
  800613:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800617:	0f be d0             	movsbl %al,%edx
  80061a:	85 d2                	test   %edx,%edx
  80061c:	74 4b                	je     800669 <vprintfmt+0x23f>
  80061e:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800622:	78 06                	js     80062a <vprintfmt+0x200>
  800624:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800628:	78 1e                	js     800648 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  80062a:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  80062e:	74 d1                	je     800601 <vprintfmt+0x1d7>
  800630:	0f be c0             	movsbl %al,%eax
  800633:	83 e8 20             	sub    $0x20,%eax
  800636:	83 f8 5e             	cmp    $0x5e,%eax
  800639:	76 c6                	jbe    800601 <vprintfmt+0x1d7>
					putch('?', putdat);
  80063b:	83 ec 08             	sub    $0x8,%esp
  80063e:	53                   	push   %ebx
  80063f:	6a 3f                	push   $0x3f
  800641:	ff d6                	call   *%esi
  800643:	83 c4 10             	add    $0x10,%esp
  800646:	eb c3                	jmp    80060b <vprintfmt+0x1e1>
  800648:	89 cf                	mov    %ecx,%edi
  80064a:	eb 0e                	jmp    80065a <vprintfmt+0x230>
				putch(' ', putdat);
  80064c:	83 ec 08             	sub    $0x8,%esp
  80064f:	53                   	push   %ebx
  800650:	6a 20                	push   $0x20
  800652:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800654:	83 ef 01             	sub    $0x1,%edi
  800657:	83 c4 10             	add    $0x10,%esp
  80065a:	85 ff                	test   %edi,%edi
  80065c:	7f ee                	jg     80064c <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  80065e:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800661:	89 45 14             	mov    %eax,0x14(%ebp)
  800664:	e9 36 01 00 00       	jmp    80079f <vprintfmt+0x375>
  800669:	89 cf                	mov    %ecx,%edi
  80066b:	eb ed                	jmp    80065a <vprintfmt+0x230>
	if (lflag >= 2)
  80066d:	83 f9 01             	cmp    $0x1,%ecx
  800670:	7f 1f                	jg     800691 <vprintfmt+0x267>
	else if (lflag)
  800672:	85 c9                	test   %ecx,%ecx
  800674:	74 67                	je     8006dd <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800676:	8b 45 14             	mov    0x14(%ebp),%eax
  800679:	8b 00                	mov    (%eax),%eax
  80067b:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80067e:	89 c1                	mov    %eax,%ecx
  800680:	c1 f9 1f             	sar    $0x1f,%ecx
  800683:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800686:	8b 45 14             	mov    0x14(%ebp),%eax
  800689:	8d 40 04             	lea    0x4(%eax),%eax
  80068c:	89 45 14             	mov    %eax,0x14(%ebp)
  80068f:	eb 17                	jmp    8006a8 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800691:	8b 45 14             	mov    0x14(%ebp),%eax
  800694:	8b 50 04             	mov    0x4(%eax),%edx
  800697:	8b 00                	mov    (%eax),%eax
  800699:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80069c:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80069f:	8b 45 14             	mov    0x14(%ebp),%eax
  8006a2:	8d 40 08             	lea    0x8(%eax),%eax
  8006a5:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  8006a8:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8006ab:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  8006ae:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8006b3:	85 c9                	test   %ecx,%ecx
  8006b5:	0f 89 ca 00 00 00    	jns    800785 <vprintfmt+0x35b>
				putch('-', putdat);
  8006bb:	83 ec 08             	sub    $0x8,%esp
  8006be:	53                   	push   %ebx
  8006bf:	6a 2d                	push   $0x2d
  8006c1:	ff d6                	call   *%esi
				num = -(long long) num;
  8006c3:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8006c6:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8006c9:	f7 da                	neg    %edx
  8006cb:	83 d1 00             	adc    $0x0,%ecx
  8006ce:	f7 d9                	neg    %ecx
  8006d0:	83 c4 10             	add    $0x10,%esp
			base = 10;
  8006d3:	b8 0a 00 00 00       	mov    $0xa,%eax
  8006d8:	e9 a8 00 00 00       	jmp    800785 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  8006dd:	8b 45 14             	mov    0x14(%ebp),%eax
  8006e0:	8b 00                	mov    (%eax),%eax
  8006e2:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8006e5:	99                   	cltd   
  8006e6:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8006e9:	8b 45 14             	mov    0x14(%ebp),%eax
  8006ec:	8d 40 04             	lea    0x4(%eax),%eax
  8006ef:	89 45 14             	mov    %eax,0x14(%ebp)
  8006f2:	eb b4                	jmp    8006a8 <vprintfmt+0x27e>
	if (lflag >= 2)
  8006f4:	83 f9 01             	cmp    $0x1,%ecx
  8006f7:	7f 1b                	jg     800714 <vprintfmt+0x2ea>
	else if (lflag)
  8006f9:	85 c9                	test   %ecx,%ecx
  8006fb:	74 2c                	je     800729 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  8006fd:	8b 45 14             	mov    0x14(%ebp),%eax
  800700:	8b 10                	mov    (%eax),%edx
  800702:	b9 00 00 00 00       	mov    $0x0,%ecx
  800707:	8d 40 04             	lea    0x4(%eax),%eax
  80070a:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80070d:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800712:	eb 71                	jmp    800785 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800714:	8b 45 14             	mov    0x14(%ebp),%eax
  800717:	8b 10                	mov    (%eax),%edx
  800719:	8b 48 04             	mov    0x4(%eax),%ecx
  80071c:	8d 40 08             	lea    0x8(%eax),%eax
  80071f:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800722:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800727:	eb 5c                	jmp    800785 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800729:	8b 45 14             	mov    0x14(%ebp),%eax
  80072c:	8b 10                	mov    (%eax),%edx
  80072e:	b9 00 00 00 00       	mov    $0x0,%ecx
  800733:	8d 40 04             	lea    0x4(%eax),%eax
  800736:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800739:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  80073e:	eb 45                	jmp    800785 <vprintfmt+0x35b>
			putch('X', putdat);
  800740:	83 ec 08             	sub    $0x8,%esp
  800743:	53                   	push   %ebx
  800744:	6a 58                	push   $0x58
  800746:	ff d6                	call   *%esi
			putch('X', putdat);
  800748:	83 c4 08             	add    $0x8,%esp
  80074b:	53                   	push   %ebx
  80074c:	6a 58                	push   $0x58
  80074e:	ff d6                	call   *%esi
			putch('X', putdat);
  800750:	83 c4 08             	add    $0x8,%esp
  800753:	53                   	push   %ebx
  800754:	6a 58                	push   $0x58
  800756:	ff d6                	call   *%esi
			break;
  800758:	83 c4 10             	add    $0x10,%esp
  80075b:	eb 42                	jmp    80079f <vprintfmt+0x375>
			putch('0', putdat);
  80075d:	83 ec 08             	sub    $0x8,%esp
  800760:	53                   	push   %ebx
  800761:	6a 30                	push   $0x30
  800763:	ff d6                	call   *%esi
			putch('x', putdat);
  800765:	83 c4 08             	add    $0x8,%esp
  800768:	53                   	push   %ebx
  800769:	6a 78                	push   $0x78
  80076b:	ff d6                	call   *%esi
			num = (unsigned long long)
  80076d:	8b 45 14             	mov    0x14(%ebp),%eax
  800770:	8b 10                	mov    (%eax),%edx
  800772:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800777:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  80077a:	8d 40 04             	lea    0x4(%eax),%eax
  80077d:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800780:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800785:	83 ec 0c             	sub    $0xc,%esp
  800788:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  80078c:	57                   	push   %edi
  80078d:	ff 75 d4             	pushl  -0x2c(%ebp)
  800790:	50                   	push   %eax
  800791:	51                   	push   %ecx
  800792:	52                   	push   %edx
  800793:	89 da                	mov    %ebx,%edx
  800795:	89 f0                	mov    %esi,%eax
  800797:	e8 a3 fb ff ff       	call   80033f <printnum>
			break;
  80079c:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  80079f:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  8007a2:	83 c7 01             	add    $0x1,%edi
  8007a5:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8007a9:	83 f8 25             	cmp    $0x25,%eax
  8007ac:	0f 84 93 fc ff ff    	je     800445 <vprintfmt+0x1b>
			if (ch == '\0')
  8007b2:	85 c0                	test   %eax,%eax
  8007b4:	0f 84 8b 00 00 00    	je     800845 <vprintfmt+0x41b>
			putch(ch, putdat);
  8007ba:	83 ec 08             	sub    $0x8,%esp
  8007bd:	53                   	push   %ebx
  8007be:	50                   	push   %eax
  8007bf:	ff d6                	call   *%esi
  8007c1:	83 c4 10             	add    $0x10,%esp
  8007c4:	eb dc                	jmp    8007a2 <vprintfmt+0x378>
	if (lflag >= 2)
  8007c6:	83 f9 01             	cmp    $0x1,%ecx
  8007c9:	7f 1b                	jg     8007e6 <vprintfmt+0x3bc>
	else if (lflag)
  8007cb:	85 c9                	test   %ecx,%ecx
  8007cd:	74 2c                	je     8007fb <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8007cf:	8b 45 14             	mov    0x14(%ebp),%eax
  8007d2:	8b 10                	mov    (%eax),%edx
  8007d4:	b9 00 00 00 00       	mov    $0x0,%ecx
  8007d9:	8d 40 04             	lea    0x4(%eax),%eax
  8007dc:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8007df:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  8007e4:	eb 9f                	jmp    800785 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8007e6:	8b 45 14             	mov    0x14(%ebp),%eax
  8007e9:	8b 10                	mov    (%eax),%edx
  8007eb:	8b 48 04             	mov    0x4(%eax),%ecx
  8007ee:	8d 40 08             	lea    0x8(%eax),%eax
  8007f1:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8007f4:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8007f9:	eb 8a                	jmp    800785 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8007fb:	8b 45 14             	mov    0x14(%ebp),%eax
  8007fe:	8b 10                	mov    (%eax),%edx
  800800:	b9 00 00 00 00       	mov    $0x0,%ecx
  800805:	8d 40 04             	lea    0x4(%eax),%eax
  800808:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80080b:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800810:	e9 70 ff ff ff       	jmp    800785 <vprintfmt+0x35b>
			putch(ch, putdat);
  800815:	83 ec 08             	sub    $0x8,%esp
  800818:	53                   	push   %ebx
  800819:	6a 25                	push   $0x25
  80081b:	ff d6                	call   *%esi
			break;
  80081d:	83 c4 10             	add    $0x10,%esp
  800820:	e9 7a ff ff ff       	jmp    80079f <vprintfmt+0x375>
			putch('%', putdat);
  800825:	83 ec 08             	sub    $0x8,%esp
  800828:	53                   	push   %ebx
  800829:	6a 25                	push   $0x25
  80082b:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  80082d:	83 c4 10             	add    $0x10,%esp
  800830:	89 f8                	mov    %edi,%eax
  800832:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  800836:	74 05                	je     80083d <vprintfmt+0x413>
  800838:	83 e8 01             	sub    $0x1,%eax
  80083b:	eb f5                	jmp    800832 <vprintfmt+0x408>
  80083d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800840:	e9 5a ff ff ff       	jmp    80079f <vprintfmt+0x375>
}
  800845:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800848:	5b                   	pop    %ebx
  800849:	5e                   	pop    %esi
  80084a:	5f                   	pop    %edi
  80084b:	5d                   	pop    %ebp
  80084c:	c3                   	ret    

0080084d <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  80084d:	f3 0f 1e fb          	endbr32 
  800851:	55                   	push   %ebp
  800852:	89 e5                	mov    %esp,%ebp
  800854:	83 ec 18             	sub    $0x18,%esp
  800857:	8b 45 08             	mov    0x8(%ebp),%eax
  80085a:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  80085d:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800860:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800864:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800867:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80086e:	85 c0                	test   %eax,%eax
  800870:	74 26                	je     800898 <vsnprintf+0x4b>
  800872:	85 d2                	test   %edx,%edx
  800874:	7e 22                	jle    800898 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800876:	ff 75 14             	pushl  0x14(%ebp)
  800879:	ff 75 10             	pushl  0x10(%ebp)
  80087c:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80087f:	50                   	push   %eax
  800880:	68 e8 03 80 00       	push   $0x8003e8
  800885:	e8 a0 fb ff ff       	call   80042a <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  80088a:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80088d:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800890:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800893:	83 c4 10             	add    $0x10,%esp
}
  800896:	c9                   	leave  
  800897:	c3                   	ret    
		return -E_INVAL;
  800898:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80089d:	eb f7                	jmp    800896 <vsnprintf+0x49>

0080089f <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  80089f:	f3 0f 1e fb          	endbr32 
  8008a3:	55                   	push   %ebp
  8008a4:	89 e5                	mov    %esp,%ebp
  8008a6:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  8008a9:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  8008ac:	50                   	push   %eax
  8008ad:	ff 75 10             	pushl  0x10(%ebp)
  8008b0:	ff 75 0c             	pushl  0xc(%ebp)
  8008b3:	ff 75 08             	pushl  0x8(%ebp)
  8008b6:	e8 92 ff ff ff       	call   80084d <vsnprintf>
	va_end(ap);

	return rc;
}
  8008bb:	c9                   	leave  
  8008bc:	c3                   	ret    

008008bd <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8008bd:	f3 0f 1e fb          	endbr32 
  8008c1:	55                   	push   %ebp
  8008c2:	89 e5                	mov    %esp,%ebp
  8008c4:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8008c7:	b8 00 00 00 00       	mov    $0x0,%eax
  8008cc:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8008d0:	74 05                	je     8008d7 <strlen+0x1a>
		n++;
  8008d2:	83 c0 01             	add    $0x1,%eax
  8008d5:	eb f5                	jmp    8008cc <strlen+0xf>
	return n;
}
  8008d7:	5d                   	pop    %ebp
  8008d8:	c3                   	ret    

008008d9 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8008d9:	f3 0f 1e fb          	endbr32 
  8008dd:	55                   	push   %ebp
  8008de:	89 e5                	mov    %esp,%ebp
  8008e0:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008e3:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8008e6:	b8 00 00 00 00       	mov    $0x0,%eax
  8008eb:	39 d0                	cmp    %edx,%eax
  8008ed:	74 0d                	je     8008fc <strnlen+0x23>
  8008ef:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  8008f3:	74 05                	je     8008fa <strnlen+0x21>
		n++;
  8008f5:	83 c0 01             	add    $0x1,%eax
  8008f8:	eb f1                	jmp    8008eb <strnlen+0x12>
  8008fa:	89 c2                	mov    %eax,%edx
	return n;
}
  8008fc:	89 d0                	mov    %edx,%eax
  8008fe:	5d                   	pop    %ebp
  8008ff:	c3                   	ret    

00800900 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800900:	f3 0f 1e fb          	endbr32 
  800904:	55                   	push   %ebp
  800905:	89 e5                	mov    %esp,%ebp
  800907:	53                   	push   %ebx
  800908:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80090b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  80090e:	b8 00 00 00 00       	mov    $0x0,%eax
  800913:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800917:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  80091a:	83 c0 01             	add    $0x1,%eax
  80091d:	84 d2                	test   %dl,%dl
  80091f:	75 f2                	jne    800913 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800921:	89 c8                	mov    %ecx,%eax
  800923:	5b                   	pop    %ebx
  800924:	5d                   	pop    %ebp
  800925:	c3                   	ret    

00800926 <strcat>:

char *
strcat(char *dst, const char *src)
{
  800926:	f3 0f 1e fb          	endbr32 
  80092a:	55                   	push   %ebp
  80092b:	89 e5                	mov    %esp,%ebp
  80092d:	53                   	push   %ebx
  80092e:	83 ec 10             	sub    $0x10,%esp
  800931:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800934:	53                   	push   %ebx
  800935:	e8 83 ff ff ff       	call   8008bd <strlen>
  80093a:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  80093d:	ff 75 0c             	pushl  0xc(%ebp)
  800940:	01 d8                	add    %ebx,%eax
  800942:	50                   	push   %eax
  800943:	e8 b8 ff ff ff       	call   800900 <strcpy>
	return dst;
}
  800948:	89 d8                	mov    %ebx,%eax
  80094a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80094d:	c9                   	leave  
  80094e:	c3                   	ret    

0080094f <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  80094f:	f3 0f 1e fb          	endbr32 
  800953:	55                   	push   %ebp
  800954:	89 e5                	mov    %esp,%ebp
  800956:	56                   	push   %esi
  800957:	53                   	push   %ebx
  800958:	8b 75 08             	mov    0x8(%ebp),%esi
  80095b:	8b 55 0c             	mov    0xc(%ebp),%edx
  80095e:	89 f3                	mov    %esi,%ebx
  800960:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800963:	89 f0                	mov    %esi,%eax
  800965:	39 d8                	cmp    %ebx,%eax
  800967:	74 11                	je     80097a <strncpy+0x2b>
		*dst++ = *src;
  800969:	83 c0 01             	add    $0x1,%eax
  80096c:	0f b6 0a             	movzbl (%edx),%ecx
  80096f:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800972:	80 f9 01             	cmp    $0x1,%cl
  800975:	83 da ff             	sbb    $0xffffffff,%edx
  800978:	eb eb                	jmp    800965 <strncpy+0x16>
	}
	return ret;
}
  80097a:	89 f0                	mov    %esi,%eax
  80097c:	5b                   	pop    %ebx
  80097d:	5e                   	pop    %esi
  80097e:	5d                   	pop    %ebp
  80097f:	c3                   	ret    

00800980 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800980:	f3 0f 1e fb          	endbr32 
  800984:	55                   	push   %ebp
  800985:	89 e5                	mov    %esp,%ebp
  800987:	56                   	push   %esi
  800988:	53                   	push   %ebx
  800989:	8b 75 08             	mov    0x8(%ebp),%esi
  80098c:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80098f:	8b 55 10             	mov    0x10(%ebp),%edx
  800992:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800994:	85 d2                	test   %edx,%edx
  800996:	74 21                	je     8009b9 <strlcpy+0x39>
  800998:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  80099c:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  80099e:	39 c2                	cmp    %eax,%edx
  8009a0:	74 14                	je     8009b6 <strlcpy+0x36>
  8009a2:	0f b6 19             	movzbl (%ecx),%ebx
  8009a5:	84 db                	test   %bl,%bl
  8009a7:	74 0b                	je     8009b4 <strlcpy+0x34>
			*dst++ = *src++;
  8009a9:	83 c1 01             	add    $0x1,%ecx
  8009ac:	83 c2 01             	add    $0x1,%edx
  8009af:	88 5a ff             	mov    %bl,-0x1(%edx)
  8009b2:	eb ea                	jmp    80099e <strlcpy+0x1e>
  8009b4:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  8009b6:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  8009b9:	29 f0                	sub    %esi,%eax
}
  8009bb:	5b                   	pop    %ebx
  8009bc:	5e                   	pop    %esi
  8009bd:	5d                   	pop    %ebp
  8009be:	c3                   	ret    

008009bf <strcmp>:

int
strcmp(const char *p, const char *q)
{
  8009bf:	f3 0f 1e fb          	endbr32 
  8009c3:	55                   	push   %ebp
  8009c4:	89 e5                	mov    %esp,%ebp
  8009c6:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8009c9:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8009cc:	0f b6 01             	movzbl (%ecx),%eax
  8009cf:	84 c0                	test   %al,%al
  8009d1:	74 0c                	je     8009df <strcmp+0x20>
  8009d3:	3a 02                	cmp    (%edx),%al
  8009d5:	75 08                	jne    8009df <strcmp+0x20>
		p++, q++;
  8009d7:	83 c1 01             	add    $0x1,%ecx
  8009da:	83 c2 01             	add    $0x1,%edx
  8009dd:	eb ed                	jmp    8009cc <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  8009df:	0f b6 c0             	movzbl %al,%eax
  8009e2:	0f b6 12             	movzbl (%edx),%edx
  8009e5:	29 d0                	sub    %edx,%eax
}
  8009e7:	5d                   	pop    %ebp
  8009e8:	c3                   	ret    

008009e9 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  8009e9:	f3 0f 1e fb          	endbr32 
  8009ed:	55                   	push   %ebp
  8009ee:	89 e5                	mov    %esp,%ebp
  8009f0:	53                   	push   %ebx
  8009f1:	8b 45 08             	mov    0x8(%ebp),%eax
  8009f4:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009f7:	89 c3                	mov    %eax,%ebx
  8009f9:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  8009fc:	eb 06                	jmp    800a04 <strncmp+0x1b>
		n--, p++, q++;
  8009fe:	83 c0 01             	add    $0x1,%eax
  800a01:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800a04:	39 d8                	cmp    %ebx,%eax
  800a06:	74 16                	je     800a1e <strncmp+0x35>
  800a08:	0f b6 08             	movzbl (%eax),%ecx
  800a0b:	84 c9                	test   %cl,%cl
  800a0d:	74 04                	je     800a13 <strncmp+0x2a>
  800a0f:	3a 0a                	cmp    (%edx),%cl
  800a11:	74 eb                	je     8009fe <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800a13:	0f b6 00             	movzbl (%eax),%eax
  800a16:	0f b6 12             	movzbl (%edx),%edx
  800a19:	29 d0                	sub    %edx,%eax
}
  800a1b:	5b                   	pop    %ebx
  800a1c:	5d                   	pop    %ebp
  800a1d:	c3                   	ret    
		return 0;
  800a1e:	b8 00 00 00 00       	mov    $0x0,%eax
  800a23:	eb f6                	jmp    800a1b <strncmp+0x32>

00800a25 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800a25:	f3 0f 1e fb          	endbr32 
  800a29:	55                   	push   %ebp
  800a2a:	89 e5                	mov    %esp,%ebp
  800a2c:	8b 45 08             	mov    0x8(%ebp),%eax
  800a2f:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800a33:	0f b6 10             	movzbl (%eax),%edx
  800a36:	84 d2                	test   %dl,%dl
  800a38:	74 09                	je     800a43 <strchr+0x1e>
		if (*s == c)
  800a3a:	38 ca                	cmp    %cl,%dl
  800a3c:	74 0a                	je     800a48 <strchr+0x23>
	for (; *s; s++)
  800a3e:	83 c0 01             	add    $0x1,%eax
  800a41:	eb f0                	jmp    800a33 <strchr+0xe>
			return (char *) s;
	return 0;
  800a43:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a48:	5d                   	pop    %ebp
  800a49:	c3                   	ret    

00800a4a <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800a4a:	f3 0f 1e fb          	endbr32 
  800a4e:	55                   	push   %ebp
  800a4f:	89 e5                	mov    %esp,%ebp
  800a51:	8b 45 08             	mov    0x8(%ebp),%eax
  800a54:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800a58:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800a5b:	38 ca                	cmp    %cl,%dl
  800a5d:	74 09                	je     800a68 <strfind+0x1e>
  800a5f:	84 d2                	test   %dl,%dl
  800a61:	74 05                	je     800a68 <strfind+0x1e>
	for (; *s; s++)
  800a63:	83 c0 01             	add    $0x1,%eax
  800a66:	eb f0                	jmp    800a58 <strfind+0xe>
			break;
	return (char *) s;
}
  800a68:	5d                   	pop    %ebp
  800a69:	c3                   	ret    

00800a6a <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800a6a:	f3 0f 1e fb          	endbr32 
  800a6e:	55                   	push   %ebp
  800a6f:	89 e5                	mov    %esp,%ebp
  800a71:	57                   	push   %edi
  800a72:	56                   	push   %esi
  800a73:	53                   	push   %ebx
  800a74:	8b 7d 08             	mov    0x8(%ebp),%edi
  800a77:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800a7a:	85 c9                	test   %ecx,%ecx
  800a7c:	74 31                	je     800aaf <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800a7e:	89 f8                	mov    %edi,%eax
  800a80:	09 c8                	or     %ecx,%eax
  800a82:	a8 03                	test   $0x3,%al
  800a84:	75 23                	jne    800aa9 <memset+0x3f>
		c &= 0xFF;
  800a86:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800a8a:	89 d3                	mov    %edx,%ebx
  800a8c:	c1 e3 08             	shl    $0x8,%ebx
  800a8f:	89 d0                	mov    %edx,%eax
  800a91:	c1 e0 18             	shl    $0x18,%eax
  800a94:	89 d6                	mov    %edx,%esi
  800a96:	c1 e6 10             	shl    $0x10,%esi
  800a99:	09 f0                	or     %esi,%eax
  800a9b:	09 c2                	or     %eax,%edx
  800a9d:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800a9f:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800aa2:	89 d0                	mov    %edx,%eax
  800aa4:	fc                   	cld    
  800aa5:	f3 ab                	rep stos %eax,%es:(%edi)
  800aa7:	eb 06                	jmp    800aaf <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800aa9:	8b 45 0c             	mov    0xc(%ebp),%eax
  800aac:	fc                   	cld    
  800aad:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800aaf:	89 f8                	mov    %edi,%eax
  800ab1:	5b                   	pop    %ebx
  800ab2:	5e                   	pop    %esi
  800ab3:	5f                   	pop    %edi
  800ab4:	5d                   	pop    %ebp
  800ab5:	c3                   	ret    

00800ab6 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800ab6:	f3 0f 1e fb          	endbr32 
  800aba:	55                   	push   %ebp
  800abb:	89 e5                	mov    %esp,%ebp
  800abd:	57                   	push   %edi
  800abe:	56                   	push   %esi
  800abf:	8b 45 08             	mov    0x8(%ebp),%eax
  800ac2:	8b 75 0c             	mov    0xc(%ebp),%esi
  800ac5:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800ac8:	39 c6                	cmp    %eax,%esi
  800aca:	73 32                	jae    800afe <memmove+0x48>
  800acc:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800acf:	39 c2                	cmp    %eax,%edx
  800ad1:	76 2b                	jbe    800afe <memmove+0x48>
		s += n;
		d += n;
  800ad3:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800ad6:	89 fe                	mov    %edi,%esi
  800ad8:	09 ce                	or     %ecx,%esi
  800ada:	09 d6                	or     %edx,%esi
  800adc:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800ae2:	75 0e                	jne    800af2 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800ae4:	83 ef 04             	sub    $0x4,%edi
  800ae7:	8d 72 fc             	lea    -0x4(%edx),%esi
  800aea:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800aed:	fd                   	std    
  800aee:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800af0:	eb 09                	jmp    800afb <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800af2:	83 ef 01             	sub    $0x1,%edi
  800af5:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800af8:	fd                   	std    
  800af9:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800afb:	fc                   	cld    
  800afc:	eb 1a                	jmp    800b18 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800afe:	89 c2                	mov    %eax,%edx
  800b00:	09 ca                	or     %ecx,%edx
  800b02:	09 f2                	or     %esi,%edx
  800b04:	f6 c2 03             	test   $0x3,%dl
  800b07:	75 0a                	jne    800b13 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800b09:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800b0c:	89 c7                	mov    %eax,%edi
  800b0e:	fc                   	cld    
  800b0f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800b11:	eb 05                	jmp    800b18 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800b13:	89 c7                	mov    %eax,%edi
  800b15:	fc                   	cld    
  800b16:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800b18:	5e                   	pop    %esi
  800b19:	5f                   	pop    %edi
  800b1a:	5d                   	pop    %ebp
  800b1b:	c3                   	ret    

00800b1c <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800b1c:	f3 0f 1e fb          	endbr32 
  800b20:	55                   	push   %ebp
  800b21:	89 e5                	mov    %esp,%ebp
  800b23:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800b26:	ff 75 10             	pushl  0x10(%ebp)
  800b29:	ff 75 0c             	pushl  0xc(%ebp)
  800b2c:	ff 75 08             	pushl  0x8(%ebp)
  800b2f:	e8 82 ff ff ff       	call   800ab6 <memmove>
}
  800b34:	c9                   	leave  
  800b35:	c3                   	ret    

00800b36 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800b36:	f3 0f 1e fb          	endbr32 
  800b3a:	55                   	push   %ebp
  800b3b:	89 e5                	mov    %esp,%ebp
  800b3d:	56                   	push   %esi
  800b3e:	53                   	push   %ebx
  800b3f:	8b 45 08             	mov    0x8(%ebp),%eax
  800b42:	8b 55 0c             	mov    0xc(%ebp),%edx
  800b45:	89 c6                	mov    %eax,%esi
  800b47:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800b4a:	39 f0                	cmp    %esi,%eax
  800b4c:	74 1c                	je     800b6a <memcmp+0x34>
		if (*s1 != *s2)
  800b4e:	0f b6 08             	movzbl (%eax),%ecx
  800b51:	0f b6 1a             	movzbl (%edx),%ebx
  800b54:	38 d9                	cmp    %bl,%cl
  800b56:	75 08                	jne    800b60 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800b58:	83 c0 01             	add    $0x1,%eax
  800b5b:	83 c2 01             	add    $0x1,%edx
  800b5e:	eb ea                	jmp    800b4a <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800b60:	0f b6 c1             	movzbl %cl,%eax
  800b63:	0f b6 db             	movzbl %bl,%ebx
  800b66:	29 d8                	sub    %ebx,%eax
  800b68:	eb 05                	jmp    800b6f <memcmp+0x39>
	}

	return 0;
  800b6a:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800b6f:	5b                   	pop    %ebx
  800b70:	5e                   	pop    %esi
  800b71:	5d                   	pop    %ebp
  800b72:	c3                   	ret    

00800b73 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800b73:	f3 0f 1e fb          	endbr32 
  800b77:	55                   	push   %ebp
  800b78:	89 e5                	mov    %esp,%ebp
  800b7a:	8b 45 08             	mov    0x8(%ebp),%eax
  800b7d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800b80:	89 c2                	mov    %eax,%edx
  800b82:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800b85:	39 d0                	cmp    %edx,%eax
  800b87:	73 09                	jae    800b92 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800b89:	38 08                	cmp    %cl,(%eax)
  800b8b:	74 05                	je     800b92 <memfind+0x1f>
	for (; s < ends; s++)
  800b8d:	83 c0 01             	add    $0x1,%eax
  800b90:	eb f3                	jmp    800b85 <memfind+0x12>
			break;
	return (void *) s;
}
  800b92:	5d                   	pop    %ebp
  800b93:	c3                   	ret    

00800b94 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800b94:	f3 0f 1e fb          	endbr32 
  800b98:	55                   	push   %ebp
  800b99:	89 e5                	mov    %esp,%ebp
  800b9b:	57                   	push   %edi
  800b9c:	56                   	push   %esi
  800b9d:	53                   	push   %ebx
  800b9e:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800ba1:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800ba4:	eb 03                	jmp    800ba9 <strtol+0x15>
		s++;
  800ba6:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800ba9:	0f b6 01             	movzbl (%ecx),%eax
  800bac:	3c 20                	cmp    $0x20,%al
  800bae:	74 f6                	je     800ba6 <strtol+0x12>
  800bb0:	3c 09                	cmp    $0x9,%al
  800bb2:	74 f2                	je     800ba6 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800bb4:	3c 2b                	cmp    $0x2b,%al
  800bb6:	74 2a                	je     800be2 <strtol+0x4e>
	int neg = 0;
  800bb8:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800bbd:	3c 2d                	cmp    $0x2d,%al
  800bbf:	74 2b                	je     800bec <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800bc1:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800bc7:	75 0f                	jne    800bd8 <strtol+0x44>
  800bc9:	80 39 30             	cmpb   $0x30,(%ecx)
  800bcc:	74 28                	je     800bf6 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800bce:	85 db                	test   %ebx,%ebx
  800bd0:	b8 0a 00 00 00       	mov    $0xa,%eax
  800bd5:	0f 44 d8             	cmove  %eax,%ebx
  800bd8:	b8 00 00 00 00       	mov    $0x0,%eax
  800bdd:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800be0:	eb 46                	jmp    800c28 <strtol+0x94>
		s++;
  800be2:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800be5:	bf 00 00 00 00       	mov    $0x0,%edi
  800bea:	eb d5                	jmp    800bc1 <strtol+0x2d>
		s++, neg = 1;
  800bec:	83 c1 01             	add    $0x1,%ecx
  800bef:	bf 01 00 00 00       	mov    $0x1,%edi
  800bf4:	eb cb                	jmp    800bc1 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800bf6:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800bfa:	74 0e                	je     800c0a <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800bfc:	85 db                	test   %ebx,%ebx
  800bfe:	75 d8                	jne    800bd8 <strtol+0x44>
		s++, base = 8;
  800c00:	83 c1 01             	add    $0x1,%ecx
  800c03:	bb 08 00 00 00       	mov    $0x8,%ebx
  800c08:	eb ce                	jmp    800bd8 <strtol+0x44>
		s += 2, base = 16;
  800c0a:	83 c1 02             	add    $0x2,%ecx
  800c0d:	bb 10 00 00 00       	mov    $0x10,%ebx
  800c12:	eb c4                	jmp    800bd8 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800c14:	0f be d2             	movsbl %dl,%edx
  800c17:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800c1a:	3b 55 10             	cmp    0x10(%ebp),%edx
  800c1d:	7d 3a                	jge    800c59 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800c1f:	83 c1 01             	add    $0x1,%ecx
  800c22:	0f af 45 10          	imul   0x10(%ebp),%eax
  800c26:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800c28:	0f b6 11             	movzbl (%ecx),%edx
  800c2b:	8d 72 d0             	lea    -0x30(%edx),%esi
  800c2e:	89 f3                	mov    %esi,%ebx
  800c30:	80 fb 09             	cmp    $0x9,%bl
  800c33:	76 df                	jbe    800c14 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800c35:	8d 72 9f             	lea    -0x61(%edx),%esi
  800c38:	89 f3                	mov    %esi,%ebx
  800c3a:	80 fb 19             	cmp    $0x19,%bl
  800c3d:	77 08                	ja     800c47 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800c3f:	0f be d2             	movsbl %dl,%edx
  800c42:	83 ea 57             	sub    $0x57,%edx
  800c45:	eb d3                	jmp    800c1a <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800c47:	8d 72 bf             	lea    -0x41(%edx),%esi
  800c4a:	89 f3                	mov    %esi,%ebx
  800c4c:	80 fb 19             	cmp    $0x19,%bl
  800c4f:	77 08                	ja     800c59 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800c51:	0f be d2             	movsbl %dl,%edx
  800c54:	83 ea 37             	sub    $0x37,%edx
  800c57:	eb c1                	jmp    800c1a <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800c59:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800c5d:	74 05                	je     800c64 <strtol+0xd0>
		*endptr = (char *) s;
  800c5f:	8b 75 0c             	mov    0xc(%ebp),%esi
  800c62:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800c64:	89 c2                	mov    %eax,%edx
  800c66:	f7 da                	neg    %edx
  800c68:	85 ff                	test   %edi,%edi
  800c6a:	0f 45 c2             	cmovne %edx,%eax
}
  800c6d:	5b                   	pop    %ebx
  800c6e:	5e                   	pop    %esi
  800c6f:	5f                   	pop    %edi
  800c70:	5d                   	pop    %ebp
  800c71:	c3                   	ret    

00800c72 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800c72:	f3 0f 1e fb          	endbr32 
  800c76:	55                   	push   %ebp
  800c77:	89 e5                	mov    %esp,%ebp
  800c79:	57                   	push   %edi
  800c7a:	56                   	push   %esi
  800c7b:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c7c:	b8 00 00 00 00       	mov    $0x0,%eax
  800c81:	8b 55 08             	mov    0x8(%ebp),%edx
  800c84:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c87:	89 c3                	mov    %eax,%ebx
  800c89:	89 c7                	mov    %eax,%edi
  800c8b:	89 c6                	mov    %eax,%esi
  800c8d:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800c8f:	5b                   	pop    %ebx
  800c90:	5e                   	pop    %esi
  800c91:	5f                   	pop    %edi
  800c92:	5d                   	pop    %ebp
  800c93:	c3                   	ret    

00800c94 <sys_cgetc>:

int
sys_cgetc(void)
{
  800c94:	f3 0f 1e fb          	endbr32 
  800c98:	55                   	push   %ebp
  800c99:	89 e5                	mov    %esp,%ebp
  800c9b:	57                   	push   %edi
  800c9c:	56                   	push   %esi
  800c9d:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c9e:	ba 00 00 00 00       	mov    $0x0,%edx
  800ca3:	b8 01 00 00 00       	mov    $0x1,%eax
  800ca8:	89 d1                	mov    %edx,%ecx
  800caa:	89 d3                	mov    %edx,%ebx
  800cac:	89 d7                	mov    %edx,%edi
  800cae:	89 d6                	mov    %edx,%esi
  800cb0:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800cb2:	5b                   	pop    %ebx
  800cb3:	5e                   	pop    %esi
  800cb4:	5f                   	pop    %edi
  800cb5:	5d                   	pop    %ebp
  800cb6:	c3                   	ret    

00800cb7 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800cb7:	f3 0f 1e fb          	endbr32 
  800cbb:	55                   	push   %ebp
  800cbc:	89 e5                	mov    %esp,%ebp
  800cbe:	57                   	push   %edi
  800cbf:	56                   	push   %esi
  800cc0:	53                   	push   %ebx
  800cc1:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cc4:	b9 00 00 00 00       	mov    $0x0,%ecx
  800cc9:	8b 55 08             	mov    0x8(%ebp),%edx
  800ccc:	b8 03 00 00 00       	mov    $0x3,%eax
  800cd1:	89 cb                	mov    %ecx,%ebx
  800cd3:	89 cf                	mov    %ecx,%edi
  800cd5:	89 ce                	mov    %ecx,%esi
  800cd7:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cd9:	85 c0                	test   %eax,%eax
  800cdb:	7f 08                	jg     800ce5 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800cdd:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ce0:	5b                   	pop    %ebx
  800ce1:	5e                   	pop    %esi
  800ce2:	5f                   	pop    %edi
  800ce3:	5d                   	pop    %ebp
  800ce4:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ce5:	83 ec 0c             	sub    $0xc,%esp
  800ce8:	50                   	push   %eax
  800ce9:	6a 03                	push   $0x3
  800ceb:	68 ff 28 80 00       	push   $0x8028ff
  800cf0:	6a 23                	push   $0x23
  800cf2:	68 1c 29 80 00       	push   $0x80291c
  800cf7:	e8 44 f5 ff ff       	call   800240 <_panic>

00800cfc <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800cfc:	f3 0f 1e fb          	endbr32 
  800d00:	55                   	push   %ebp
  800d01:	89 e5                	mov    %esp,%ebp
  800d03:	57                   	push   %edi
  800d04:	56                   	push   %esi
  800d05:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d06:	ba 00 00 00 00       	mov    $0x0,%edx
  800d0b:	b8 02 00 00 00       	mov    $0x2,%eax
  800d10:	89 d1                	mov    %edx,%ecx
  800d12:	89 d3                	mov    %edx,%ebx
  800d14:	89 d7                	mov    %edx,%edi
  800d16:	89 d6                	mov    %edx,%esi
  800d18:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800d1a:	5b                   	pop    %ebx
  800d1b:	5e                   	pop    %esi
  800d1c:	5f                   	pop    %edi
  800d1d:	5d                   	pop    %ebp
  800d1e:	c3                   	ret    

00800d1f <sys_yield>:

void
sys_yield(void)
{
  800d1f:	f3 0f 1e fb          	endbr32 
  800d23:	55                   	push   %ebp
  800d24:	89 e5                	mov    %esp,%ebp
  800d26:	57                   	push   %edi
  800d27:	56                   	push   %esi
  800d28:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d29:	ba 00 00 00 00       	mov    $0x0,%edx
  800d2e:	b8 0b 00 00 00       	mov    $0xb,%eax
  800d33:	89 d1                	mov    %edx,%ecx
  800d35:	89 d3                	mov    %edx,%ebx
  800d37:	89 d7                	mov    %edx,%edi
  800d39:	89 d6                	mov    %edx,%esi
  800d3b:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800d3d:	5b                   	pop    %ebx
  800d3e:	5e                   	pop    %esi
  800d3f:	5f                   	pop    %edi
  800d40:	5d                   	pop    %ebp
  800d41:	c3                   	ret    

00800d42 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800d42:	f3 0f 1e fb          	endbr32 
  800d46:	55                   	push   %ebp
  800d47:	89 e5                	mov    %esp,%ebp
  800d49:	57                   	push   %edi
  800d4a:	56                   	push   %esi
  800d4b:	53                   	push   %ebx
  800d4c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d4f:	be 00 00 00 00       	mov    $0x0,%esi
  800d54:	8b 55 08             	mov    0x8(%ebp),%edx
  800d57:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d5a:	b8 04 00 00 00       	mov    $0x4,%eax
  800d5f:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800d62:	89 f7                	mov    %esi,%edi
  800d64:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d66:	85 c0                	test   %eax,%eax
  800d68:	7f 08                	jg     800d72 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800d6a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d6d:	5b                   	pop    %ebx
  800d6e:	5e                   	pop    %esi
  800d6f:	5f                   	pop    %edi
  800d70:	5d                   	pop    %ebp
  800d71:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d72:	83 ec 0c             	sub    $0xc,%esp
  800d75:	50                   	push   %eax
  800d76:	6a 04                	push   $0x4
  800d78:	68 ff 28 80 00       	push   $0x8028ff
  800d7d:	6a 23                	push   $0x23
  800d7f:	68 1c 29 80 00       	push   $0x80291c
  800d84:	e8 b7 f4 ff ff       	call   800240 <_panic>

00800d89 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800d89:	f3 0f 1e fb          	endbr32 
  800d8d:	55                   	push   %ebp
  800d8e:	89 e5                	mov    %esp,%ebp
  800d90:	57                   	push   %edi
  800d91:	56                   	push   %esi
  800d92:	53                   	push   %ebx
  800d93:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d96:	8b 55 08             	mov    0x8(%ebp),%edx
  800d99:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d9c:	b8 05 00 00 00       	mov    $0x5,%eax
  800da1:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800da4:	8b 7d 14             	mov    0x14(%ebp),%edi
  800da7:	8b 75 18             	mov    0x18(%ebp),%esi
  800daa:	cd 30                	int    $0x30
	if(check && ret > 0)
  800dac:	85 c0                	test   %eax,%eax
  800dae:	7f 08                	jg     800db8 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800db0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800db3:	5b                   	pop    %ebx
  800db4:	5e                   	pop    %esi
  800db5:	5f                   	pop    %edi
  800db6:	5d                   	pop    %ebp
  800db7:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800db8:	83 ec 0c             	sub    $0xc,%esp
  800dbb:	50                   	push   %eax
  800dbc:	6a 05                	push   $0x5
  800dbe:	68 ff 28 80 00       	push   $0x8028ff
  800dc3:	6a 23                	push   $0x23
  800dc5:	68 1c 29 80 00       	push   $0x80291c
  800dca:	e8 71 f4 ff ff       	call   800240 <_panic>

00800dcf <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800dcf:	f3 0f 1e fb          	endbr32 
  800dd3:	55                   	push   %ebp
  800dd4:	89 e5                	mov    %esp,%ebp
  800dd6:	57                   	push   %edi
  800dd7:	56                   	push   %esi
  800dd8:	53                   	push   %ebx
  800dd9:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800ddc:	bb 00 00 00 00       	mov    $0x0,%ebx
  800de1:	8b 55 08             	mov    0x8(%ebp),%edx
  800de4:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800de7:	b8 06 00 00 00       	mov    $0x6,%eax
  800dec:	89 df                	mov    %ebx,%edi
  800dee:	89 de                	mov    %ebx,%esi
  800df0:	cd 30                	int    $0x30
	if(check && ret > 0)
  800df2:	85 c0                	test   %eax,%eax
  800df4:	7f 08                	jg     800dfe <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800df6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800df9:	5b                   	pop    %ebx
  800dfa:	5e                   	pop    %esi
  800dfb:	5f                   	pop    %edi
  800dfc:	5d                   	pop    %ebp
  800dfd:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dfe:	83 ec 0c             	sub    $0xc,%esp
  800e01:	50                   	push   %eax
  800e02:	6a 06                	push   $0x6
  800e04:	68 ff 28 80 00       	push   $0x8028ff
  800e09:	6a 23                	push   $0x23
  800e0b:	68 1c 29 80 00       	push   $0x80291c
  800e10:	e8 2b f4 ff ff       	call   800240 <_panic>

00800e15 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800e15:	f3 0f 1e fb          	endbr32 
  800e19:	55                   	push   %ebp
  800e1a:	89 e5                	mov    %esp,%ebp
  800e1c:	57                   	push   %edi
  800e1d:	56                   	push   %esi
  800e1e:	53                   	push   %ebx
  800e1f:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e22:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e27:	8b 55 08             	mov    0x8(%ebp),%edx
  800e2a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e2d:	b8 08 00 00 00       	mov    $0x8,%eax
  800e32:	89 df                	mov    %ebx,%edi
  800e34:	89 de                	mov    %ebx,%esi
  800e36:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e38:	85 c0                	test   %eax,%eax
  800e3a:	7f 08                	jg     800e44 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800e3c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e3f:	5b                   	pop    %ebx
  800e40:	5e                   	pop    %esi
  800e41:	5f                   	pop    %edi
  800e42:	5d                   	pop    %ebp
  800e43:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e44:	83 ec 0c             	sub    $0xc,%esp
  800e47:	50                   	push   %eax
  800e48:	6a 08                	push   $0x8
  800e4a:	68 ff 28 80 00       	push   $0x8028ff
  800e4f:	6a 23                	push   $0x23
  800e51:	68 1c 29 80 00       	push   $0x80291c
  800e56:	e8 e5 f3 ff ff       	call   800240 <_panic>

00800e5b <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800e5b:	f3 0f 1e fb          	endbr32 
  800e5f:	55                   	push   %ebp
  800e60:	89 e5                	mov    %esp,%ebp
  800e62:	57                   	push   %edi
  800e63:	56                   	push   %esi
  800e64:	53                   	push   %ebx
  800e65:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e68:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e6d:	8b 55 08             	mov    0x8(%ebp),%edx
  800e70:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e73:	b8 09 00 00 00       	mov    $0x9,%eax
  800e78:	89 df                	mov    %ebx,%edi
  800e7a:	89 de                	mov    %ebx,%esi
  800e7c:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e7e:	85 c0                	test   %eax,%eax
  800e80:	7f 08                	jg     800e8a <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800e82:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e85:	5b                   	pop    %ebx
  800e86:	5e                   	pop    %esi
  800e87:	5f                   	pop    %edi
  800e88:	5d                   	pop    %ebp
  800e89:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e8a:	83 ec 0c             	sub    $0xc,%esp
  800e8d:	50                   	push   %eax
  800e8e:	6a 09                	push   $0x9
  800e90:	68 ff 28 80 00       	push   $0x8028ff
  800e95:	6a 23                	push   $0x23
  800e97:	68 1c 29 80 00       	push   $0x80291c
  800e9c:	e8 9f f3 ff ff       	call   800240 <_panic>

00800ea1 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800ea1:	f3 0f 1e fb          	endbr32 
  800ea5:	55                   	push   %ebp
  800ea6:	89 e5                	mov    %esp,%ebp
  800ea8:	57                   	push   %edi
  800ea9:	56                   	push   %esi
  800eaa:	53                   	push   %ebx
  800eab:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800eae:	bb 00 00 00 00       	mov    $0x0,%ebx
  800eb3:	8b 55 08             	mov    0x8(%ebp),%edx
  800eb6:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800eb9:	b8 0a 00 00 00       	mov    $0xa,%eax
  800ebe:	89 df                	mov    %ebx,%edi
  800ec0:	89 de                	mov    %ebx,%esi
  800ec2:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ec4:	85 c0                	test   %eax,%eax
  800ec6:	7f 08                	jg     800ed0 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800ec8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ecb:	5b                   	pop    %ebx
  800ecc:	5e                   	pop    %esi
  800ecd:	5f                   	pop    %edi
  800ece:	5d                   	pop    %ebp
  800ecf:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ed0:	83 ec 0c             	sub    $0xc,%esp
  800ed3:	50                   	push   %eax
  800ed4:	6a 0a                	push   $0xa
  800ed6:	68 ff 28 80 00       	push   $0x8028ff
  800edb:	6a 23                	push   $0x23
  800edd:	68 1c 29 80 00       	push   $0x80291c
  800ee2:	e8 59 f3 ff ff       	call   800240 <_panic>

00800ee7 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800ee7:	f3 0f 1e fb          	endbr32 
  800eeb:	55                   	push   %ebp
  800eec:	89 e5                	mov    %esp,%ebp
  800eee:	57                   	push   %edi
  800eef:	56                   	push   %esi
  800ef0:	53                   	push   %ebx
	asm volatile("int %1\n"
  800ef1:	8b 55 08             	mov    0x8(%ebp),%edx
  800ef4:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800ef7:	b8 0c 00 00 00       	mov    $0xc,%eax
  800efc:	be 00 00 00 00       	mov    $0x0,%esi
  800f01:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800f04:	8b 7d 14             	mov    0x14(%ebp),%edi
  800f07:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800f09:	5b                   	pop    %ebx
  800f0a:	5e                   	pop    %esi
  800f0b:	5f                   	pop    %edi
  800f0c:	5d                   	pop    %ebp
  800f0d:	c3                   	ret    

00800f0e <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800f0e:	f3 0f 1e fb          	endbr32 
  800f12:	55                   	push   %ebp
  800f13:	89 e5                	mov    %esp,%ebp
  800f15:	57                   	push   %edi
  800f16:	56                   	push   %esi
  800f17:	53                   	push   %ebx
  800f18:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800f1b:	b9 00 00 00 00       	mov    $0x0,%ecx
  800f20:	8b 55 08             	mov    0x8(%ebp),%edx
  800f23:	b8 0d 00 00 00       	mov    $0xd,%eax
  800f28:	89 cb                	mov    %ecx,%ebx
  800f2a:	89 cf                	mov    %ecx,%edi
  800f2c:	89 ce                	mov    %ecx,%esi
  800f2e:	cd 30                	int    $0x30
	if(check && ret > 0)
  800f30:	85 c0                	test   %eax,%eax
  800f32:	7f 08                	jg     800f3c <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800f34:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800f37:	5b                   	pop    %ebx
  800f38:	5e                   	pop    %esi
  800f39:	5f                   	pop    %edi
  800f3a:	5d                   	pop    %ebp
  800f3b:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800f3c:	83 ec 0c             	sub    $0xc,%esp
  800f3f:	50                   	push   %eax
  800f40:	6a 0d                	push   $0xd
  800f42:	68 ff 28 80 00       	push   $0x8028ff
  800f47:	6a 23                	push   $0x23
  800f49:	68 1c 29 80 00       	push   $0x80291c
  800f4e:	e8 ed f2 ff ff       	call   800240 <_panic>

00800f53 <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800f53:	f3 0f 1e fb          	endbr32 
  800f57:	55                   	push   %ebp
  800f58:	89 e5                	mov    %esp,%ebp
  800f5a:	56                   	push   %esi
  800f5b:	53                   	push   %ebx
  800f5c:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800f5f:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800f61:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800f65:	0f 84 b2 00 00 00    	je     80101d <pgfault+0xca>
  800f6b:	89 d8                	mov    %ebx,%eax
  800f6d:	c1 e8 16             	shr    $0x16,%eax
  800f70:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800f77:	a8 01                	test   $0x1,%al
  800f79:	0f 84 9e 00 00 00    	je     80101d <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800f7f:	89 d8                	mov    %ebx,%eax
  800f81:	c1 e8 0c             	shr    $0xc,%eax
  800f84:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800f8b:	f6 c2 01             	test   $0x1,%dl
  800f8e:	0f 84 89 00 00 00    	je     80101d <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800f94:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800f9b:	f6 c4 08             	test   $0x8,%ah
  800f9e:	74 7d                	je     80101d <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800fa0:	e8 57 fd ff ff       	call   800cfc <sys_getenvid>
  800fa5:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800fa7:	83 ec 04             	sub    $0x4,%esp
  800faa:	6a 07                	push   $0x7
  800fac:	68 00 f0 7f 00       	push   $0x7ff000
  800fb1:	50                   	push   %eax
  800fb2:	e8 8b fd ff ff       	call   800d42 <sys_page_alloc>
	if(r<0){
  800fb7:	83 c4 10             	add    $0x10,%esp
  800fba:	85 c0                	test   %eax,%eax
  800fbc:	78 73                	js     801031 <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800fbe:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800fc4:	83 ec 04             	sub    $0x4,%esp
  800fc7:	68 00 10 00 00       	push   $0x1000
  800fcc:	53                   	push   %ebx
  800fcd:	68 00 f0 7f 00       	push   $0x7ff000
  800fd2:	e8 df fa ff ff       	call   800ab6 <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800fd7:	83 c4 08             	add    $0x8,%esp
  800fda:	53                   	push   %ebx
  800fdb:	56                   	push   %esi
  800fdc:	e8 ee fd ff ff       	call   800dcf <sys_page_unmap>
	if(r<0)
  800fe1:	83 c4 10             	add    $0x10,%esp
  800fe4:	85 c0                	test   %eax,%eax
  800fe6:	78 5b                	js     801043 <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  800fe8:	83 ec 0c             	sub    $0xc,%esp
  800feb:	6a 07                	push   $0x7
  800fed:	53                   	push   %ebx
  800fee:	56                   	push   %esi
  800fef:	68 00 f0 7f 00       	push   $0x7ff000
  800ff4:	56                   	push   %esi
  800ff5:	e8 8f fd ff ff       	call   800d89 <sys_page_map>
	if(r<0)
  800ffa:	83 c4 20             	add    $0x20,%esp
  800ffd:	85 c0                	test   %eax,%eax
  800fff:	78 54                	js     801055 <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  801001:	83 ec 08             	sub    $0x8,%esp
  801004:	68 00 f0 7f 00       	push   $0x7ff000
  801009:	56                   	push   %esi
  80100a:	e8 c0 fd ff ff       	call   800dcf <sys_page_unmap>
	if(r<0)
  80100f:	83 c4 10             	add    $0x10,%esp
  801012:	85 c0                	test   %eax,%eax
  801014:	78 51                	js     801067 <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  801016:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801019:	5b                   	pop    %ebx
  80101a:	5e                   	pop    %esi
  80101b:	5d                   	pop    %ebp
  80101c:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  80101d:	83 ec 04             	sub    $0x4,%esp
  801020:	68 2c 29 80 00       	push   $0x80292c
  801025:	6a 2c                	push   $0x2c
  801027:	68 db 29 80 00       	push   $0x8029db
  80102c:	e8 0f f2 ff ff       	call   800240 <_panic>
		 panic("pgfault: page allocation failed %e", r);
  801031:	50                   	push   %eax
  801032:	68 6c 29 80 00       	push   $0x80296c
  801037:	6a 31                	push   $0x31
  801039:	68 db 29 80 00       	push   $0x8029db
  80103e:	e8 fd f1 ff ff       	call   800240 <_panic>
	panic("pgfault: page unmap failed %e", r);
  801043:	50                   	push   %eax
  801044:	68 e6 29 80 00       	push   $0x8029e6
  801049:	6a 3b                	push   $0x3b
  80104b:	68 db 29 80 00       	push   $0x8029db
  801050:	e8 eb f1 ff ff       	call   800240 <_panic>
	panic("pgfault: page map failed %e", r);
  801055:	50                   	push   %eax
  801056:	68 04 2a 80 00       	push   $0x802a04
  80105b:	6a 3e                	push   $0x3e
  80105d:	68 db 29 80 00       	push   $0x8029db
  801062:	e8 d9 f1 ff ff       	call   800240 <_panic>
	panic("pgfault: page unmap failed %e", r);
  801067:	50                   	push   %eax
  801068:	68 e6 29 80 00       	push   $0x8029e6
  80106d:	6a 41                	push   $0x41
  80106f:	68 db 29 80 00       	push   $0x8029db
  801074:	e8 c7 f1 ff ff       	call   800240 <_panic>

00801079 <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  801079:	f3 0f 1e fb          	endbr32 
  80107d:	55                   	push   %ebp
  80107e:	89 e5                	mov    %esp,%ebp
  801080:	57                   	push   %edi
  801081:	56                   	push   %esi
  801082:	53                   	push   %ebx
  801083:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  801086:	68 53 0f 80 00       	push   $0x800f53
  80108b:	e8 9c 0f 00 00       	call   80202c <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  801090:	b8 07 00 00 00       	mov    $0x7,%eax
  801095:	cd 30                	int    $0x30
  801097:	89 c7                	mov    %eax,%edi
  801099:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  80109c:	83 c4 10             	add    $0x10,%esp
  80109f:	85 c0                	test   %eax,%eax
  8010a1:	0f 8e 9d 01 00 00    	jle    801244 <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  8010a7:	bb 00 00 80 00       	mov    $0x800000,%ebx
  8010ac:	eb 5b                	jmp    801109 <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  8010ae:	83 ec 0c             	sub    $0xc,%esp
  8010b1:	68 07 0e 00 00       	push   $0xe07
  8010b6:	56                   	push   %esi
  8010b7:	ff 75 e4             	pushl  -0x1c(%ebp)
  8010ba:	56                   	push   %esi
  8010bb:	6a 00                	push   $0x0
  8010bd:	e8 c7 fc ff ff       	call   800d89 <sys_page_map>
  8010c2:	83 c4 20             	add    $0x20,%esp
  8010c5:	eb 30                	jmp    8010f7 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  8010c7:	83 ec 04             	sub    $0x4,%esp
  8010ca:	68 20 2a 80 00       	push   $0x802a20
  8010cf:	6a 63                	push   $0x63
  8010d1:	68 db 29 80 00       	push   $0x8029db
  8010d6:	e8 65 f1 ff ff       	call   800240 <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  8010db:	83 ec 0c             	sub    $0xc,%esp
  8010de:	6a 05                	push   $0x5
  8010e0:	56                   	push   %esi
  8010e1:	ff 75 e4             	pushl  -0x1c(%ebp)
  8010e4:	56                   	push   %esi
  8010e5:	6a 00                	push   $0x0
  8010e7:	e8 9d fc ff ff       	call   800d89 <sys_page_map>
            if(r < 0)
  8010ec:	83 c4 20             	add    $0x20,%esp
  8010ef:	85 c0                	test   %eax,%eax
  8010f1:	0f 88 ac 00 00 00    	js     8011a3 <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  8010f7:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  8010fd:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  801103:	0f 84 ae 00 00 00    	je     8011b7 <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  801109:	89 d8                	mov    %ebx,%eax
  80110b:	c1 e8 16             	shr    $0x16,%eax
  80110e:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801115:	a8 01                	test   $0x1,%al
  801117:	74 de                	je     8010f7 <fork+0x7e>
			pn=PGNUM(pageVa);
  801119:	89 d8                	mov    %ebx,%eax
  80111b:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  80111e:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801125:	f6 c2 01             	test   $0x1,%dl
  801128:	74 cd                	je     8010f7 <fork+0x7e>
  80112a:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801131:	f6 c2 04             	test   $0x4,%dl
  801134:	74 c1                	je     8010f7 <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  801136:	89 c6                	mov    %eax,%esi
  801138:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  80113b:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  801142:	f6 c4 04             	test   $0x4,%ah
  801145:	0f 85 63 ff ff ff    	jne    8010ae <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  80114b:	a9 02 08 00 00       	test   $0x802,%eax
  801150:	74 89                	je     8010db <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  801152:	83 ec 0c             	sub    $0xc,%esp
  801155:	68 05 08 00 00       	push   $0x805
  80115a:	56                   	push   %esi
  80115b:	ff 75 e4             	pushl  -0x1c(%ebp)
  80115e:	56                   	push   %esi
  80115f:	6a 00                	push   $0x0
  801161:	e8 23 fc ff ff       	call   800d89 <sys_page_map>
            if(r < 0)
  801166:	83 c4 20             	add    $0x20,%esp
  801169:	85 c0                	test   %eax,%eax
  80116b:	0f 88 56 ff ff ff    	js     8010c7 <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  801171:	83 ec 0c             	sub    $0xc,%esp
  801174:	68 05 08 00 00       	push   $0x805
  801179:	56                   	push   %esi
  80117a:	6a 00                	push   $0x0
  80117c:	56                   	push   %esi
  80117d:	6a 00                	push   $0x0
  80117f:	e8 05 fc ff ff       	call   800d89 <sys_page_map>
            if(r < 0)
  801184:	83 c4 20             	add    $0x20,%esp
  801187:	85 c0                	test   %eax,%eax
  801189:	0f 89 68 ff ff ff    	jns    8010f7 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  80118f:	83 ec 04             	sub    $0x4,%esp
  801192:	68 20 2a 80 00       	push   $0x802a20
  801197:	6a 66                	push   $0x66
  801199:	68 db 29 80 00       	push   $0x8029db
  80119e:	e8 9d f0 ff ff       	call   800240 <_panic>
                panic("duppage: sys_page_map fail\n");
  8011a3:	83 ec 04             	sub    $0x4,%esp
  8011a6:	68 20 2a 80 00       	push   $0x802a20
  8011ab:	6a 6c                	push   $0x6c
  8011ad:	68 db 29 80 00       	push   $0x8029db
  8011b2:	e8 89 f0 ff ff       	call   800240 <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  8011b7:	83 ec 04             	sub    $0x4,%esp
  8011ba:	6a 07                	push   $0x7
  8011bc:	68 00 f0 bf ee       	push   $0xeebff000
  8011c1:	57                   	push   %edi
  8011c2:	e8 7b fb ff ff       	call   800d42 <sys_page_alloc>
		if(flag<0){
  8011c7:	83 c4 10             	add    $0x10,%esp
  8011ca:	85 c0                	test   %eax,%eax
  8011cc:	78 31                	js     8011ff <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  8011ce:	83 ec 08             	sub    $0x8,%esp
  8011d1:	68 a6 20 80 00       	push   $0x8020a6
  8011d6:	57                   	push   %edi
  8011d7:	e8 c5 fc ff ff       	call   800ea1 <sys_env_set_pgfault_upcall>
		if(flag<0){
  8011dc:	83 c4 10             	add    $0x10,%esp
  8011df:	85 c0                	test   %eax,%eax
  8011e1:	78 33                	js     801216 <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  8011e3:	83 ec 08             	sub    $0x8,%esp
  8011e6:	6a 02                	push   $0x2
  8011e8:	57                   	push   %edi
  8011e9:	e8 27 fc ff ff       	call   800e15 <sys_env_set_status>
		if(flag<0){
  8011ee:	83 c4 10             	add    $0x10,%esp
  8011f1:	85 c0                	test   %eax,%eax
  8011f3:	78 38                	js     80122d <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  8011f5:	89 f8                	mov    %edi,%eax
  8011f7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8011fa:	5b                   	pop    %ebx
  8011fb:	5e                   	pop    %esi
  8011fc:	5f                   	pop    %edi
  8011fd:	5d                   	pop    %ebp
  8011fe:	c3                   	ret    
			panic("panic by alloc page");
  8011ff:	83 ec 04             	sub    $0x4,%esp
  801202:	68 3c 2a 80 00       	push   $0x802a3c
  801207:	68 98 00 00 00       	push   $0x98
  80120c:	68 db 29 80 00       	push   $0x8029db
  801211:	e8 2a f0 ff ff       	call   800240 <_panic>
			panic("panic by set pgfault upcall faction");
  801216:	83 ec 04             	sub    $0x4,%esp
  801219:	68 90 29 80 00       	push   $0x802990
  80121e:	68 9e 00 00 00       	push   $0x9e
  801223:	68 db 29 80 00       	push   $0x8029db
  801228:	e8 13 f0 ff ff       	call   800240 <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  80122d:	83 ec 04             	sub    $0x4,%esp
  801230:	68 b4 29 80 00       	push   $0x8029b4
  801235:	68 a3 00 00 00       	push   $0xa3
  80123a:	68 db 29 80 00       	push   $0x8029db
  80123f:	e8 fc ef ff ff       	call   800240 <_panic>
	else if(envid==0){
  801244:	75 19                	jne    80125f <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  801246:	e8 b1 fa ff ff       	call   800cfc <sys_getenvid>
  80124b:	25 ff 03 00 00       	and    $0x3ff,%eax
  801250:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801253:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801258:	a3 20 44 80 00       	mov    %eax,0x804420
		return 0;
  80125d:	eb 96                	jmp    8011f5 <fork+0x17c>
		panic("panic by alloc envid");
  80125f:	83 ec 04             	sub    $0x4,%esp
  801262:	68 50 2a 80 00       	push   $0x802a50
  801267:	68 ad 00 00 00       	push   $0xad
  80126c:	68 db 29 80 00       	push   $0x8029db
  801271:	e8 ca ef ff ff       	call   800240 <_panic>

00801276 <sfork>:

// Challenge!
int
sfork(void)
{
  801276:	f3 0f 1e fb          	endbr32 
  80127a:	55                   	push   %ebp
  80127b:	89 e5                	mov    %esp,%ebp
  80127d:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  801280:	68 65 2a 80 00       	push   $0x802a65
  801285:	68 b7 00 00 00       	push   $0xb7
  80128a:	68 db 29 80 00       	push   $0x8029db
  80128f:	e8 ac ef ff ff       	call   800240 <_panic>

00801294 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  801294:	f3 0f 1e fb          	endbr32 
  801298:	55                   	push   %ebp
  801299:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  80129b:	8b 45 08             	mov    0x8(%ebp),%eax
  80129e:	05 00 00 00 30       	add    $0x30000000,%eax
  8012a3:	c1 e8 0c             	shr    $0xc,%eax
}
  8012a6:	5d                   	pop    %ebp
  8012a7:	c3                   	ret    

008012a8 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  8012a8:	f3 0f 1e fb          	endbr32 
  8012ac:	55                   	push   %ebp
  8012ad:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8012af:	8b 45 08             	mov    0x8(%ebp),%eax
  8012b2:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  8012b7:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  8012bc:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  8012c1:	5d                   	pop    %ebp
  8012c2:	c3                   	ret    

008012c3 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  8012c3:	f3 0f 1e fb          	endbr32 
  8012c7:	55                   	push   %ebp
  8012c8:	89 e5                	mov    %esp,%ebp
  8012ca:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  8012cf:	89 c2                	mov    %eax,%edx
  8012d1:	c1 ea 16             	shr    $0x16,%edx
  8012d4:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  8012db:	f6 c2 01             	test   $0x1,%dl
  8012de:	74 2d                	je     80130d <fd_alloc+0x4a>
  8012e0:	89 c2                	mov    %eax,%edx
  8012e2:	c1 ea 0c             	shr    $0xc,%edx
  8012e5:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8012ec:	f6 c2 01             	test   $0x1,%dl
  8012ef:	74 1c                	je     80130d <fd_alloc+0x4a>
  8012f1:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  8012f6:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  8012fb:	75 d2                	jne    8012cf <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  8012fd:	8b 45 08             	mov    0x8(%ebp),%eax
  801300:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  801306:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  80130b:	eb 0a                	jmp    801317 <fd_alloc+0x54>
			*fd_store = fd;
  80130d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801310:	89 01                	mov    %eax,(%ecx)
			return 0;
  801312:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801317:	5d                   	pop    %ebp
  801318:	c3                   	ret    

00801319 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  801319:	f3 0f 1e fb          	endbr32 
  80131d:	55                   	push   %ebp
  80131e:	89 e5                	mov    %esp,%ebp
  801320:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  801323:	83 f8 1f             	cmp    $0x1f,%eax
  801326:	77 30                	ja     801358 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  801328:	c1 e0 0c             	shl    $0xc,%eax
  80132b:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  801330:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  801336:	f6 c2 01             	test   $0x1,%dl
  801339:	74 24                	je     80135f <fd_lookup+0x46>
  80133b:	89 c2                	mov    %eax,%edx
  80133d:	c1 ea 0c             	shr    $0xc,%edx
  801340:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801347:	f6 c2 01             	test   $0x1,%dl
  80134a:	74 1a                	je     801366 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  80134c:	8b 55 0c             	mov    0xc(%ebp),%edx
  80134f:	89 02                	mov    %eax,(%edx)
	return 0;
  801351:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801356:	5d                   	pop    %ebp
  801357:	c3                   	ret    
		return -E_INVAL;
  801358:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80135d:	eb f7                	jmp    801356 <fd_lookup+0x3d>
		return -E_INVAL;
  80135f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801364:	eb f0                	jmp    801356 <fd_lookup+0x3d>
  801366:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80136b:	eb e9                	jmp    801356 <fd_lookup+0x3d>

0080136d <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  80136d:	f3 0f 1e fb          	endbr32 
  801371:	55                   	push   %ebp
  801372:	89 e5                	mov    %esp,%ebp
  801374:	83 ec 08             	sub    $0x8,%esp
  801377:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80137a:	ba f8 2a 80 00       	mov    $0x802af8,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  80137f:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  801384:	39 08                	cmp    %ecx,(%eax)
  801386:	74 33                	je     8013bb <dev_lookup+0x4e>
  801388:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  80138b:	8b 02                	mov    (%edx),%eax
  80138d:	85 c0                	test   %eax,%eax
  80138f:	75 f3                	jne    801384 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  801391:	a1 20 44 80 00       	mov    0x804420,%eax
  801396:	8b 40 48             	mov    0x48(%eax),%eax
  801399:	83 ec 04             	sub    $0x4,%esp
  80139c:	51                   	push   %ecx
  80139d:	50                   	push   %eax
  80139e:	68 7c 2a 80 00       	push   $0x802a7c
  8013a3:	e8 7f ef ff ff       	call   800327 <cprintf>
	*dev = 0;
  8013a8:	8b 45 0c             	mov    0xc(%ebp),%eax
  8013ab:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  8013b1:	83 c4 10             	add    $0x10,%esp
  8013b4:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  8013b9:	c9                   	leave  
  8013ba:	c3                   	ret    
			*dev = devtab[i];
  8013bb:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8013be:	89 01                	mov    %eax,(%ecx)
			return 0;
  8013c0:	b8 00 00 00 00       	mov    $0x0,%eax
  8013c5:	eb f2                	jmp    8013b9 <dev_lookup+0x4c>

008013c7 <fd_close>:
{
  8013c7:	f3 0f 1e fb          	endbr32 
  8013cb:	55                   	push   %ebp
  8013cc:	89 e5                	mov    %esp,%ebp
  8013ce:	57                   	push   %edi
  8013cf:	56                   	push   %esi
  8013d0:	53                   	push   %ebx
  8013d1:	83 ec 24             	sub    $0x24,%esp
  8013d4:	8b 75 08             	mov    0x8(%ebp),%esi
  8013d7:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8013da:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8013dd:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8013de:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  8013e4:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8013e7:	50                   	push   %eax
  8013e8:	e8 2c ff ff ff       	call   801319 <fd_lookup>
  8013ed:	89 c3                	mov    %eax,%ebx
  8013ef:	83 c4 10             	add    $0x10,%esp
  8013f2:	85 c0                	test   %eax,%eax
  8013f4:	78 05                	js     8013fb <fd_close+0x34>
	    || fd != fd2)
  8013f6:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  8013f9:	74 16                	je     801411 <fd_close+0x4a>
		return (must_exist ? r : 0);
  8013fb:	89 f8                	mov    %edi,%eax
  8013fd:	84 c0                	test   %al,%al
  8013ff:	b8 00 00 00 00       	mov    $0x0,%eax
  801404:	0f 44 d8             	cmove  %eax,%ebx
}
  801407:	89 d8                	mov    %ebx,%eax
  801409:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80140c:	5b                   	pop    %ebx
  80140d:	5e                   	pop    %esi
  80140e:	5f                   	pop    %edi
  80140f:	5d                   	pop    %ebp
  801410:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  801411:	83 ec 08             	sub    $0x8,%esp
  801414:	8d 45 e0             	lea    -0x20(%ebp),%eax
  801417:	50                   	push   %eax
  801418:	ff 36                	pushl  (%esi)
  80141a:	e8 4e ff ff ff       	call   80136d <dev_lookup>
  80141f:	89 c3                	mov    %eax,%ebx
  801421:	83 c4 10             	add    $0x10,%esp
  801424:	85 c0                	test   %eax,%eax
  801426:	78 1a                	js     801442 <fd_close+0x7b>
		if (dev->dev_close)
  801428:	8b 45 e0             	mov    -0x20(%ebp),%eax
  80142b:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  80142e:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  801433:	85 c0                	test   %eax,%eax
  801435:	74 0b                	je     801442 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  801437:	83 ec 0c             	sub    $0xc,%esp
  80143a:	56                   	push   %esi
  80143b:	ff d0                	call   *%eax
  80143d:	89 c3                	mov    %eax,%ebx
  80143f:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801442:	83 ec 08             	sub    $0x8,%esp
  801445:	56                   	push   %esi
  801446:	6a 00                	push   $0x0
  801448:	e8 82 f9 ff ff       	call   800dcf <sys_page_unmap>
	return r;
  80144d:	83 c4 10             	add    $0x10,%esp
  801450:	eb b5                	jmp    801407 <fd_close+0x40>

00801452 <close>:

int
close(int fdnum)
{
  801452:	f3 0f 1e fb          	endbr32 
  801456:	55                   	push   %ebp
  801457:	89 e5                	mov    %esp,%ebp
  801459:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80145c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80145f:	50                   	push   %eax
  801460:	ff 75 08             	pushl  0x8(%ebp)
  801463:	e8 b1 fe ff ff       	call   801319 <fd_lookup>
  801468:	83 c4 10             	add    $0x10,%esp
  80146b:	85 c0                	test   %eax,%eax
  80146d:	79 02                	jns    801471 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  80146f:	c9                   	leave  
  801470:	c3                   	ret    
		return fd_close(fd, 1);
  801471:	83 ec 08             	sub    $0x8,%esp
  801474:	6a 01                	push   $0x1
  801476:	ff 75 f4             	pushl  -0xc(%ebp)
  801479:	e8 49 ff ff ff       	call   8013c7 <fd_close>
  80147e:	83 c4 10             	add    $0x10,%esp
  801481:	eb ec                	jmp    80146f <close+0x1d>

00801483 <close_all>:

void
close_all(void)
{
  801483:	f3 0f 1e fb          	endbr32 
  801487:	55                   	push   %ebp
  801488:	89 e5                	mov    %esp,%ebp
  80148a:	53                   	push   %ebx
  80148b:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  80148e:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801493:	83 ec 0c             	sub    $0xc,%esp
  801496:	53                   	push   %ebx
  801497:	e8 b6 ff ff ff       	call   801452 <close>
	for (i = 0; i < MAXFD; i++)
  80149c:	83 c3 01             	add    $0x1,%ebx
  80149f:	83 c4 10             	add    $0x10,%esp
  8014a2:	83 fb 20             	cmp    $0x20,%ebx
  8014a5:	75 ec                	jne    801493 <close_all+0x10>
}
  8014a7:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8014aa:	c9                   	leave  
  8014ab:	c3                   	ret    

008014ac <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  8014ac:	f3 0f 1e fb          	endbr32 
  8014b0:	55                   	push   %ebp
  8014b1:	89 e5                	mov    %esp,%ebp
  8014b3:	57                   	push   %edi
  8014b4:	56                   	push   %esi
  8014b5:	53                   	push   %ebx
  8014b6:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  8014b9:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8014bc:	50                   	push   %eax
  8014bd:	ff 75 08             	pushl  0x8(%ebp)
  8014c0:	e8 54 fe ff ff       	call   801319 <fd_lookup>
  8014c5:	89 c3                	mov    %eax,%ebx
  8014c7:	83 c4 10             	add    $0x10,%esp
  8014ca:	85 c0                	test   %eax,%eax
  8014cc:	0f 88 81 00 00 00    	js     801553 <dup+0xa7>
		return r;
	close(newfdnum);
  8014d2:	83 ec 0c             	sub    $0xc,%esp
  8014d5:	ff 75 0c             	pushl  0xc(%ebp)
  8014d8:	e8 75 ff ff ff       	call   801452 <close>

	newfd = INDEX2FD(newfdnum);
  8014dd:	8b 75 0c             	mov    0xc(%ebp),%esi
  8014e0:	c1 e6 0c             	shl    $0xc,%esi
  8014e3:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  8014e9:	83 c4 04             	add    $0x4,%esp
  8014ec:	ff 75 e4             	pushl  -0x1c(%ebp)
  8014ef:	e8 b4 fd ff ff       	call   8012a8 <fd2data>
  8014f4:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  8014f6:	89 34 24             	mov    %esi,(%esp)
  8014f9:	e8 aa fd ff ff       	call   8012a8 <fd2data>
  8014fe:	83 c4 10             	add    $0x10,%esp
  801501:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  801503:	89 d8                	mov    %ebx,%eax
  801505:	c1 e8 16             	shr    $0x16,%eax
  801508:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  80150f:	a8 01                	test   $0x1,%al
  801511:	74 11                	je     801524 <dup+0x78>
  801513:	89 d8                	mov    %ebx,%eax
  801515:	c1 e8 0c             	shr    $0xc,%eax
  801518:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  80151f:	f6 c2 01             	test   $0x1,%dl
  801522:	75 39                	jne    80155d <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  801524:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  801527:	89 d0                	mov    %edx,%eax
  801529:	c1 e8 0c             	shr    $0xc,%eax
  80152c:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801533:	83 ec 0c             	sub    $0xc,%esp
  801536:	25 07 0e 00 00       	and    $0xe07,%eax
  80153b:	50                   	push   %eax
  80153c:	56                   	push   %esi
  80153d:	6a 00                	push   $0x0
  80153f:	52                   	push   %edx
  801540:	6a 00                	push   $0x0
  801542:	e8 42 f8 ff ff       	call   800d89 <sys_page_map>
  801547:	89 c3                	mov    %eax,%ebx
  801549:	83 c4 20             	add    $0x20,%esp
  80154c:	85 c0                	test   %eax,%eax
  80154e:	78 31                	js     801581 <dup+0xd5>
		goto err;

	return newfdnum;
  801550:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  801553:	89 d8                	mov    %ebx,%eax
  801555:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801558:	5b                   	pop    %ebx
  801559:	5e                   	pop    %esi
  80155a:	5f                   	pop    %edi
  80155b:	5d                   	pop    %ebp
  80155c:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  80155d:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801564:	83 ec 0c             	sub    $0xc,%esp
  801567:	25 07 0e 00 00       	and    $0xe07,%eax
  80156c:	50                   	push   %eax
  80156d:	57                   	push   %edi
  80156e:	6a 00                	push   $0x0
  801570:	53                   	push   %ebx
  801571:	6a 00                	push   $0x0
  801573:	e8 11 f8 ff ff       	call   800d89 <sys_page_map>
  801578:	89 c3                	mov    %eax,%ebx
  80157a:	83 c4 20             	add    $0x20,%esp
  80157d:	85 c0                	test   %eax,%eax
  80157f:	79 a3                	jns    801524 <dup+0x78>
	sys_page_unmap(0, newfd);
  801581:	83 ec 08             	sub    $0x8,%esp
  801584:	56                   	push   %esi
  801585:	6a 00                	push   $0x0
  801587:	e8 43 f8 ff ff       	call   800dcf <sys_page_unmap>
	sys_page_unmap(0, nva);
  80158c:	83 c4 08             	add    $0x8,%esp
  80158f:	57                   	push   %edi
  801590:	6a 00                	push   $0x0
  801592:	e8 38 f8 ff ff       	call   800dcf <sys_page_unmap>
	return r;
  801597:	83 c4 10             	add    $0x10,%esp
  80159a:	eb b7                	jmp    801553 <dup+0xa7>

0080159c <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  80159c:	f3 0f 1e fb          	endbr32 
  8015a0:	55                   	push   %ebp
  8015a1:	89 e5                	mov    %esp,%ebp
  8015a3:	53                   	push   %ebx
  8015a4:	83 ec 1c             	sub    $0x1c,%esp
  8015a7:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8015aa:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8015ad:	50                   	push   %eax
  8015ae:	53                   	push   %ebx
  8015af:	e8 65 fd ff ff       	call   801319 <fd_lookup>
  8015b4:	83 c4 10             	add    $0x10,%esp
  8015b7:	85 c0                	test   %eax,%eax
  8015b9:	78 3f                	js     8015fa <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8015bb:	83 ec 08             	sub    $0x8,%esp
  8015be:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015c1:	50                   	push   %eax
  8015c2:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8015c5:	ff 30                	pushl  (%eax)
  8015c7:	e8 a1 fd ff ff       	call   80136d <dev_lookup>
  8015cc:	83 c4 10             	add    $0x10,%esp
  8015cf:	85 c0                	test   %eax,%eax
  8015d1:	78 27                	js     8015fa <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  8015d3:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8015d6:	8b 42 08             	mov    0x8(%edx),%eax
  8015d9:	83 e0 03             	and    $0x3,%eax
  8015dc:	83 f8 01             	cmp    $0x1,%eax
  8015df:	74 1e                	je     8015ff <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  8015e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8015e4:	8b 40 08             	mov    0x8(%eax),%eax
  8015e7:	85 c0                	test   %eax,%eax
  8015e9:	74 35                	je     801620 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  8015eb:	83 ec 04             	sub    $0x4,%esp
  8015ee:	ff 75 10             	pushl  0x10(%ebp)
  8015f1:	ff 75 0c             	pushl  0xc(%ebp)
  8015f4:	52                   	push   %edx
  8015f5:	ff d0                	call   *%eax
  8015f7:	83 c4 10             	add    $0x10,%esp
}
  8015fa:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8015fd:	c9                   	leave  
  8015fe:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  8015ff:	a1 20 44 80 00       	mov    0x804420,%eax
  801604:	8b 40 48             	mov    0x48(%eax),%eax
  801607:	83 ec 04             	sub    $0x4,%esp
  80160a:	53                   	push   %ebx
  80160b:	50                   	push   %eax
  80160c:	68 bd 2a 80 00       	push   $0x802abd
  801611:	e8 11 ed ff ff       	call   800327 <cprintf>
		return -E_INVAL;
  801616:	83 c4 10             	add    $0x10,%esp
  801619:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80161e:	eb da                	jmp    8015fa <read+0x5e>
		return -E_NOT_SUPP;
  801620:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801625:	eb d3                	jmp    8015fa <read+0x5e>

00801627 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  801627:	f3 0f 1e fb          	endbr32 
  80162b:	55                   	push   %ebp
  80162c:	89 e5                	mov    %esp,%ebp
  80162e:	57                   	push   %edi
  80162f:	56                   	push   %esi
  801630:	53                   	push   %ebx
  801631:	83 ec 0c             	sub    $0xc,%esp
  801634:	8b 7d 08             	mov    0x8(%ebp),%edi
  801637:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  80163a:	bb 00 00 00 00       	mov    $0x0,%ebx
  80163f:	eb 02                	jmp    801643 <readn+0x1c>
  801641:	01 c3                	add    %eax,%ebx
  801643:	39 f3                	cmp    %esi,%ebx
  801645:	73 21                	jae    801668 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801647:	83 ec 04             	sub    $0x4,%esp
  80164a:	89 f0                	mov    %esi,%eax
  80164c:	29 d8                	sub    %ebx,%eax
  80164e:	50                   	push   %eax
  80164f:	89 d8                	mov    %ebx,%eax
  801651:	03 45 0c             	add    0xc(%ebp),%eax
  801654:	50                   	push   %eax
  801655:	57                   	push   %edi
  801656:	e8 41 ff ff ff       	call   80159c <read>
		if (m < 0)
  80165b:	83 c4 10             	add    $0x10,%esp
  80165e:	85 c0                	test   %eax,%eax
  801660:	78 04                	js     801666 <readn+0x3f>
			return m;
		if (m == 0)
  801662:	75 dd                	jne    801641 <readn+0x1a>
  801664:	eb 02                	jmp    801668 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801666:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  801668:	89 d8                	mov    %ebx,%eax
  80166a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80166d:	5b                   	pop    %ebx
  80166e:	5e                   	pop    %esi
  80166f:	5f                   	pop    %edi
  801670:	5d                   	pop    %ebp
  801671:	c3                   	ret    

00801672 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801672:	f3 0f 1e fb          	endbr32 
  801676:	55                   	push   %ebp
  801677:	89 e5                	mov    %esp,%ebp
  801679:	53                   	push   %ebx
  80167a:	83 ec 1c             	sub    $0x1c,%esp
  80167d:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801680:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801683:	50                   	push   %eax
  801684:	53                   	push   %ebx
  801685:	e8 8f fc ff ff       	call   801319 <fd_lookup>
  80168a:	83 c4 10             	add    $0x10,%esp
  80168d:	85 c0                	test   %eax,%eax
  80168f:	78 3a                	js     8016cb <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801691:	83 ec 08             	sub    $0x8,%esp
  801694:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801697:	50                   	push   %eax
  801698:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80169b:	ff 30                	pushl  (%eax)
  80169d:	e8 cb fc ff ff       	call   80136d <dev_lookup>
  8016a2:	83 c4 10             	add    $0x10,%esp
  8016a5:	85 c0                	test   %eax,%eax
  8016a7:	78 22                	js     8016cb <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8016a9:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016ac:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8016b0:	74 1e                	je     8016d0 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  8016b2:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8016b5:	8b 52 0c             	mov    0xc(%edx),%edx
  8016b8:	85 d2                	test   %edx,%edx
  8016ba:	74 35                	je     8016f1 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  8016bc:	83 ec 04             	sub    $0x4,%esp
  8016bf:	ff 75 10             	pushl  0x10(%ebp)
  8016c2:	ff 75 0c             	pushl  0xc(%ebp)
  8016c5:	50                   	push   %eax
  8016c6:	ff d2                	call   *%edx
  8016c8:	83 c4 10             	add    $0x10,%esp
}
  8016cb:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8016ce:	c9                   	leave  
  8016cf:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  8016d0:	a1 20 44 80 00       	mov    0x804420,%eax
  8016d5:	8b 40 48             	mov    0x48(%eax),%eax
  8016d8:	83 ec 04             	sub    $0x4,%esp
  8016db:	53                   	push   %ebx
  8016dc:	50                   	push   %eax
  8016dd:	68 d9 2a 80 00       	push   $0x802ad9
  8016e2:	e8 40 ec ff ff       	call   800327 <cprintf>
		return -E_INVAL;
  8016e7:	83 c4 10             	add    $0x10,%esp
  8016ea:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8016ef:	eb da                	jmp    8016cb <write+0x59>
		return -E_NOT_SUPP;
  8016f1:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8016f6:	eb d3                	jmp    8016cb <write+0x59>

008016f8 <seek>:

int
seek(int fdnum, off_t offset)
{
  8016f8:	f3 0f 1e fb          	endbr32 
  8016fc:	55                   	push   %ebp
  8016fd:	89 e5                	mov    %esp,%ebp
  8016ff:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801702:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801705:	50                   	push   %eax
  801706:	ff 75 08             	pushl  0x8(%ebp)
  801709:	e8 0b fc ff ff       	call   801319 <fd_lookup>
  80170e:	83 c4 10             	add    $0x10,%esp
  801711:	85 c0                	test   %eax,%eax
  801713:	78 0e                	js     801723 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  801715:	8b 55 0c             	mov    0xc(%ebp),%edx
  801718:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80171b:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  80171e:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801723:	c9                   	leave  
  801724:	c3                   	ret    

00801725 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  801725:	f3 0f 1e fb          	endbr32 
  801729:	55                   	push   %ebp
  80172a:	89 e5                	mov    %esp,%ebp
  80172c:	53                   	push   %ebx
  80172d:	83 ec 1c             	sub    $0x1c,%esp
  801730:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801733:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801736:	50                   	push   %eax
  801737:	53                   	push   %ebx
  801738:	e8 dc fb ff ff       	call   801319 <fd_lookup>
  80173d:	83 c4 10             	add    $0x10,%esp
  801740:	85 c0                	test   %eax,%eax
  801742:	78 37                	js     80177b <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801744:	83 ec 08             	sub    $0x8,%esp
  801747:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80174a:	50                   	push   %eax
  80174b:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80174e:	ff 30                	pushl  (%eax)
  801750:	e8 18 fc ff ff       	call   80136d <dev_lookup>
  801755:	83 c4 10             	add    $0x10,%esp
  801758:	85 c0                	test   %eax,%eax
  80175a:	78 1f                	js     80177b <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80175c:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80175f:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801763:	74 1b                	je     801780 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  801765:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801768:	8b 52 18             	mov    0x18(%edx),%edx
  80176b:	85 d2                	test   %edx,%edx
  80176d:	74 32                	je     8017a1 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  80176f:	83 ec 08             	sub    $0x8,%esp
  801772:	ff 75 0c             	pushl  0xc(%ebp)
  801775:	50                   	push   %eax
  801776:	ff d2                	call   *%edx
  801778:	83 c4 10             	add    $0x10,%esp
}
  80177b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80177e:	c9                   	leave  
  80177f:	c3                   	ret    
			thisenv->env_id, fdnum);
  801780:	a1 20 44 80 00       	mov    0x804420,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  801785:	8b 40 48             	mov    0x48(%eax),%eax
  801788:	83 ec 04             	sub    $0x4,%esp
  80178b:	53                   	push   %ebx
  80178c:	50                   	push   %eax
  80178d:	68 9c 2a 80 00       	push   $0x802a9c
  801792:	e8 90 eb ff ff       	call   800327 <cprintf>
		return -E_INVAL;
  801797:	83 c4 10             	add    $0x10,%esp
  80179a:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80179f:	eb da                	jmp    80177b <ftruncate+0x56>
		return -E_NOT_SUPP;
  8017a1:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8017a6:	eb d3                	jmp    80177b <ftruncate+0x56>

008017a8 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  8017a8:	f3 0f 1e fb          	endbr32 
  8017ac:	55                   	push   %ebp
  8017ad:	89 e5                	mov    %esp,%ebp
  8017af:	53                   	push   %ebx
  8017b0:	83 ec 1c             	sub    $0x1c,%esp
  8017b3:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8017b6:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8017b9:	50                   	push   %eax
  8017ba:	ff 75 08             	pushl  0x8(%ebp)
  8017bd:	e8 57 fb ff ff       	call   801319 <fd_lookup>
  8017c2:	83 c4 10             	add    $0x10,%esp
  8017c5:	85 c0                	test   %eax,%eax
  8017c7:	78 4b                	js     801814 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8017c9:	83 ec 08             	sub    $0x8,%esp
  8017cc:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8017cf:	50                   	push   %eax
  8017d0:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8017d3:	ff 30                	pushl  (%eax)
  8017d5:	e8 93 fb ff ff       	call   80136d <dev_lookup>
  8017da:	83 c4 10             	add    $0x10,%esp
  8017dd:	85 c0                	test   %eax,%eax
  8017df:	78 33                	js     801814 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  8017e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8017e4:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  8017e8:	74 2f                	je     801819 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  8017ea:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  8017ed:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  8017f4:	00 00 00 
	stat->st_isdir = 0;
  8017f7:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8017fe:	00 00 00 
	stat->st_dev = dev;
  801801:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801807:	83 ec 08             	sub    $0x8,%esp
  80180a:	53                   	push   %ebx
  80180b:	ff 75 f0             	pushl  -0x10(%ebp)
  80180e:	ff 50 14             	call   *0x14(%eax)
  801811:	83 c4 10             	add    $0x10,%esp
}
  801814:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801817:	c9                   	leave  
  801818:	c3                   	ret    
		return -E_NOT_SUPP;
  801819:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80181e:	eb f4                	jmp    801814 <fstat+0x6c>

00801820 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  801820:	f3 0f 1e fb          	endbr32 
  801824:	55                   	push   %ebp
  801825:	89 e5                	mov    %esp,%ebp
  801827:	56                   	push   %esi
  801828:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  801829:	83 ec 08             	sub    $0x8,%esp
  80182c:	6a 00                	push   $0x0
  80182e:	ff 75 08             	pushl  0x8(%ebp)
  801831:	e8 fb 01 00 00       	call   801a31 <open>
  801836:	89 c3                	mov    %eax,%ebx
  801838:	83 c4 10             	add    $0x10,%esp
  80183b:	85 c0                	test   %eax,%eax
  80183d:	78 1b                	js     80185a <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  80183f:	83 ec 08             	sub    $0x8,%esp
  801842:	ff 75 0c             	pushl  0xc(%ebp)
  801845:	50                   	push   %eax
  801846:	e8 5d ff ff ff       	call   8017a8 <fstat>
  80184b:	89 c6                	mov    %eax,%esi
	close(fd);
  80184d:	89 1c 24             	mov    %ebx,(%esp)
  801850:	e8 fd fb ff ff       	call   801452 <close>
	return r;
  801855:	83 c4 10             	add    $0x10,%esp
  801858:	89 f3                	mov    %esi,%ebx
}
  80185a:	89 d8                	mov    %ebx,%eax
  80185c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80185f:	5b                   	pop    %ebx
  801860:	5e                   	pop    %esi
  801861:	5d                   	pop    %ebp
  801862:	c3                   	ret    

00801863 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801863:	55                   	push   %ebp
  801864:	89 e5                	mov    %esp,%ebp
  801866:	56                   	push   %esi
  801867:	53                   	push   %ebx
  801868:	89 c6                	mov    %eax,%esi
  80186a:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  80186c:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801873:	74 27                	je     80189c <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  801875:	6a 07                	push   $0x7
  801877:	68 00 50 80 00       	push   $0x805000
  80187c:	56                   	push   %esi
  80187d:	ff 35 00 40 80 00    	pushl  0x804000
  801883:	e8 c6 08 00 00       	call   80214e <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  801888:	83 c4 0c             	add    $0xc,%esp
  80188b:	6a 00                	push   $0x0
  80188d:	53                   	push   %ebx
  80188e:	6a 00                	push   $0x0
  801890:	e8 38 08 00 00       	call   8020cd <ipc_recv>
}
  801895:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801898:	5b                   	pop    %ebx
  801899:	5e                   	pop    %esi
  80189a:	5d                   	pop    %ebp
  80189b:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  80189c:	83 ec 0c             	sub    $0xc,%esp
  80189f:	6a 01                	push   $0x1
  8018a1:	e8 00 09 00 00       	call   8021a6 <ipc_find_env>
  8018a6:	a3 00 40 80 00       	mov    %eax,0x804000
  8018ab:	83 c4 10             	add    $0x10,%esp
  8018ae:	eb c5                	jmp    801875 <fsipc+0x12>

008018b0 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  8018b0:	f3 0f 1e fb          	endbr32 
  8018b4:	55                   	push   %ebp
  8018b5:	89 e5                	mov    %esp,%ebp
  8018b7:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  8018ba:	8b 45 08             	mov    0x8(%ebp),%eax
  8018bd:	8b 40 0c             	mov    0xc(%eax),%eax
  8018c0:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  8018c5:	8b 45 0c             	mov    0xc(%ebp),%eax
  8018c8:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  8018cd:	ba 00 00 00 00       	mov    $0x0,%edx
  8018d2:	b8 02 00 00 00       	mov    $0x2,%eax
  8018d7:	e8 87 ff ff ff       	call   801863 <fsipc>
}
  8018dc:	c9                   	leave  
  8018dd:	c3                   	ret    

008018de <devfile_flush>:
{
  8018de:	f3 0f 1e fb          	endbr32 
  8018e2:	55                   	push   %ebp
  8018e3:	89 e5                	mov    %esp,%ebp
  8018e5:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  8018e8:	8b 45 08             	mov    0x8(%ebp),%eax
  8018eb:	8b 40 0c             	mov    0xc(%eax),%eax
  8018ee:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  8018f3:	ba 00 00 00 00       	mov    $0x0,%edx
  8018f8:	b8 06 00 00 00       	mov    $0x6,%eax
  8018fd:	e8 61 ff ff ff       	call   801863 <fsipc>
}
  801902:	c9                   	leave  
  801903:	c3                   	ret    

00801904 <devfile_stat>:
{
  801904:	f3 0f 1e fb          	endbr32 
  801908:	55                   	push   %ebp
  801909:	89 e5                	mov    %esp,%ebp
  80190b:	53                   	push   %ebx
  80190c:	83 ec 04             	sub    $0x4,%esp
  80190f:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801912:	8b 45 08             	mov    0x8(%ebp),%eax
  801915:	8b 40 0c             	mov    0xc(%eax),%eax
  801918:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  80191d:	ba 00 00 00 00       	mov    $0x0,%edx
  801922:	b8 05 00 00 00       	mov    $0x5,%eax
  801927:	e8 37 ff ff ff       	call   801863 <fsipc>
  80192c:	85 c0                	test   %eax,%eax
  80192e:	78 2c                	js     80195c <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801930:	83 ec 08             	sub    $0x8,%esp
  801933:	68 00 50 80 00       	push   $0x805000
  801938:	53                   	push   %ebx
  801939:	e8 c2 ef ff ff       	call   800900 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  80193e:	a1 80 50 80 00       	mov    0x805080,%eax
  801943:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801949:	a1 84 50 80 00       	mov    0x805084,%eax
  80194e:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  801954:	83 c4 10             	add    $0x10,%esp
  801957:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80195c:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80195f:	c9                   	leave  
  801960:	c3                   	ret    

00801961 <devfile_write>:
{
  801961:	f3 0f 1e fb          	endbr32 
  801965:	55                   	push   %ebp
  801966:	89 e5                	mov    %esp,%ebp
  801968:	83 ec 0c             	sub    $0xc,%esp
  80196b:	8b 45 10             	mov    0x10(%ebp),%eax
  80196e:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801973:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801978:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  80197b:	8b 55 08             	mov    0x8(%ebp),%edx
  80197e:	8b 52 0c             	mov    0xc(%edx),%edx
  801981:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801987:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  80198c:	50                   	push   %eax
  80198d:	ff 75 0c             	pushl  0xc(%ebp)
  801990:	68 08 50 80 00       	push   $0x805008
  801995:	e8 1c f1 ff ff       	call   800ab6 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  80199a:	ba 00 00 00 00       	mov    $0x0,%edx
  80199f:	b8 04 00 00 00       	mov    $0x4,%eax
  8019a4:	e8 ba fe ff ff       	call   801863 <fsipc>
  8019a9:	c9                   	leave  
  8019aa:	c3                   	ret    

008019ab <devfile_read>:
{
  8019ab:	f3 0f 1e fb          	endbr32 
  8019af:	55                   	push   %ebp
  8019b0:	89 e5                	mov    %esp,%ebp
  8019b2:	56                   	push   %esi
  8019b3:	53                   	push   %ebx
  8019b4:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  8019b7:	8b 45 08             	mov    0x8(%ebp),%eax
  8019ba:	8b 40 0c             	mov    0xc(%eax),%eax
  8019bd:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  8019c2:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  8019c8:	ba 00 00 00 00       	mov    $0x0,%edx
  8019cd:	b8 03 00 00 00       	mov    $0x3,%eax
  8019d2:	e8 8c fe ff ff       	call   801863 <fsipc>
  8019d7:	89 c3                	mov    %eax,%ebx
  8019d9:	85 c0                	test   %eax,%eax
  8019db:	78 1f                	js     8019fc <devfile_read+0x51>
	assert(r <= n);
  8019dd:	39 f0                	cmp    %esi,%eax
  8019df:	77 24                	ja     801a05 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  8019e1:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8019e6:	7f 33                	jg     801a1b <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  8019e8:	83 ec 04             	sub    $0x4,%esp
  8019eb:	50                   	push   %eax
  8019ec:	68 00 50 80 00       	push   $0x805000
  8019f1:	ff 75 0c             	pushl  0xc(%ebp)
  8019f4:	e8 bd f0 ff ff       	call   800ab6 <memmove>
	return r;
  8019f9:	83 c4 10             	add    $0x10,%esp
}
  8019fc:	89 d8                	mov    %ebx,%eax
  8019fe:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801a01:	5b                   	pop    %ebx
  801a02:	5e                   	pop    %esi
  801a03:	5d                   	pop    %ebp
  801a04:	c3                   	ret    
	assert(r <= n);
  801a05:	68 08 2b 80 00       	push   $0x802b08
  801a0a:	68 0f 2b 80 00       	push   $0x802b0f
  801a0f:	6a 7c                	push   $0x7c
  801a11:	68 24 2b 80 00       	push   $0x802b24
  801a16:	e8 25 e8 ff ff       	call   800240 <_panic>
	assert(r <= PGSIZE);
  801a1b:	68 2f 2b 80 00       	push   $0x802b2f
  801a20:	68 0f 2b 80 00       	push   $0x802b0f
  801a25:	6a 7d                	push   $0x7d
  801a27:	68 24 2b 80 00       	push   $0x802b24
  801a2c:	e8 0f e8 ff ff       	call   800240 <_panic>

00801a31 <open>:
{
  801a31:	f3 0f 1e fb          	endbr32 
  801a35:	55                   	push   %ebp
  801a36:	89 e5                	mov    %esp,%ebp
  801a38:	56                   	push   %esi
  801a39:	53                   	push   %ebx
  801a3a:	83 ec 1c             	sub    $0x1c,%esp
  801a3d:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801a40:	56                   	push   %esi
  801a41:	e8 77 ee ff ff       	call   8008bd <strlen>
  801a46:	83 c4 10             	add    $0x10,%esp
  801a49:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801a4e:	7f 6c                	jg     801abc <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801a50:	83 ec 0c             	sub    $0xc,%esp
  801a53:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801a56:	50                   	push   %eax
  801a57:	e8 67 f8 ff ff       	call   8012c3 <fd_alloc>
  801a5c:	89 c3                	mov    %eax,%ebx
  801a5e:	83 c4 10             	add    $0x10,%esp
  801a61:	85 c0                	test   %eax,%eax
  801a63:	78 3c                	js     801aa1 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801a65:	83 ec 08             	sub    $0x8,%esp
  801a68:	56                   	push   %esi
  801a69:	68 00 50 80 00       	push   $0x805000
  801a6e:	e8 8d ee ff ff       	call   800900 <strcpy>
	fsipcbuf.open.req_omode = mode;
  801a73:	8b 45 0c             	mov    0xc(%ebp),%eax
  801a76:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801a7b:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801a7e:	b8 01 00 00 00       	mov    $0x1,%eax
  801a83:	e8 db fd ff ff       	call   801863 <fsipc>
  801a88:	89 c3                	mov    %eax,%ebx
  801a8a:	83 c4 10             	add    $0x10,%esp
  801a8d:	85 c0                	test   %eax,%eax
  801a8f:	78 19                	js     801aaa <open+0x79>
	return fd2num(fd);
  801a91:	83 ec 0c             	sub    $0xc,%esp
  801a94:	ff 75 f4             	pushl  -0xc(%ebp)
  801a97:	e8 f8 f7 ff ff       	call   801294 <fd2num>
  801a9c:	89 c3                	mov    %eax,%ebx
  801a9e:	83 c4 10             	add    $0x10,%esp
}
  801aa1:	89 d8                	mov    %ebx,%eax
  801aa3:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801aa6:	5b                   	pop    %ebx
  801aa7:	5e                   	pop    %esi
  801aa8:	5d                   	pop    %ebp
  801aa9:	c3                   	ret    
		fd_close(fd, 0);
  801aaa:	83 ec 08             	sub    $0x8,%esp
  801aad:	6a 00                	push   $0x0
  801aaf:	ff 75 f4             	pushl  -0xc(%ebp)
  801ab2:	e8 10 f9 ff ff       	call   8013c7 <fd_close>
		return r;
  801ab7:	83 c4 10             	add    $0x10,%esp
  801aba:	eb e5                	jmp    801aa1 <open+0x70>
		return -E_BAD_PATH;
  801abc:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801ac1:	eb de                	jmp    801aa1 <open+0x70>

00801ac3 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801ac3:	f3 0f 1e fb          	endbr32 
  801ac7:	55                   	push   %ebp
  801ac8:	89 e5                	mov    %esp,%ebp
  801aca:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801acd:	ba 00 00 00 00       	mov    $0x0,%edx
  801ad2:	b8 08 00 00 00       	mov    $0x8,%eax
  801ad7:	e8 87 fd ff ff       	call   801863 <fsipc>
}
  801adc:	c9                   	leave  
  801add:	c3                   	ret    

00801ade <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801ade:	f3 0f 1e fb          	endbr32 
  801ae2:	55                   	push   %ebp
  801ae3:	89 e5                	mov    %esp,%ebp
  801ae5:	56                   	push   %esi
  801ae6:	53                   	push   %ebx
  801ae7:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801aea:	83 ec 0c             	sub    $0xc,%esp
  801aed:	ff 75 08             	pushl  0x8(%ebp)
  801af0:	e8 b3 f7 ff ff       	call   8012a8 <fd2data>
  801af5:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801af7:	83 c4 08             	add    $0x8,%esp
  801afa:	68 3b 2b 80 00       	push   $0x802b3b
  801aff:	53                   	push   %ebx
  801b00:	e8 fb ed ff ff       	call   800900 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801b05:	8b 46 04             	mov    0x4(%esi),%eax
  801b08:	2b 06                	sub    (%esi),%eax
  801b0a:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801b10:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801b17:	00 00 00 
	stat->st_dev = &devpipe;
  801b1a:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801b21:	30 80 00 
	return 0;
}
  801b24:	b8 00 00 00 00       	mov    $0x0,%eax
  801b29:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801b2c:	5b                   	pop    %ebx
  801b2d:	5e                   	pop    %esi
  801b2e:	5d                   	pop    %ebp
  801b2f:	c3                   	ret    

00801b30 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801b30:	f3 0f 1e fb          	endbr32 
  801b34:	55                   	push   %ebp
  801b35:	89 e5                	mov    %esp,%ebp
  801b37:	53                   	push   %ebx
  801b38:	83 ec 0c             	sub    $0xc,%esp
  801b3b:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801b3e:	53                   	push   %ebx
  801b3f:	6a 00                	push   $0x0
  801b41:	e8 89 f2 ff ff       	call   800dcf <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801b46:	89 1c 24             	mov    %ebx,(%esp)
  801b49:	e8 5a f7 ff ff       	call   8012a8 <fd2data>
  801b4e:	83 c4 08             	add    $0x8,%esp
  801b51:	50                   	push   %eax
  801b52:	6a 00                	push   $0x0
  801b54:	e8 76 f2 ff ff       	call   800dcf <sys_page_unmap>
}
  801b59:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801b5c:	c9                   	leave  
  801b5d:	c3                   	ret    

00801b5e <_pipeisclosed>:
{
  801b5e:	55                   	push   %ebp
  801b5f:	89 e5                	mov    %esp,%ebp
  801b61:	57                   	push   %edi
  801b62:	56                   	push   %esi
  801b63:	53                   	push   %ebx
  801b64:	83 ec 1c             	sub    $0x1c,%esp
  801b67:	89 c7                	mov    %eax,%edi
  801b69:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801b6b:	a1 20 44 80 00       	mov    0x804420,%eax
  801b70:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801b73:	83 ec 0c             	sub    $0xc,%esp
  801b76:	57                   	push   %edi
  801b77:	e8 67 06 00 00       	call   8021e3 <pageref>
  801b7c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801b7f:	89 34 24             	mov    %esi,(%esp)
  801b82:	e8 5c 06 00 00       	call   8021e3 <pageref>
		nn = thisenv->env_runs;
  801b87:	8b 15 20 44 80 00    	mov    0x804420,%edx
  801b8d:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801b90:	83 c4 10             	add    $0x10,%esp
  801b93:	39 cb                	cmp    %ecx,%ebx
  801b95:	74 1b                	je     801bb2 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801b97:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801b9a:	75 cf                	jne    801b6b <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801b9c:	8b 42 58             	mov    0x58(%edx),%eax
  801b9f:	6a 01                	push   $0x1
  801ba1:	50                   	push   %eax
  801ba2:	53                   	push   %ebx
  801ba3:	68 42 2b 80 00       	push   $0x802b42
  801ba8:	e8 7a e7 ff ff       	call   800327 <cprintf>
  801bad:	83 c4 10             	add    $0x10,%esp
  801bb0:	eb b9                	jmp    801b6b <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801bb2:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801bb5:	0f 94 c0             	sete   %al
  801bb8:	0f b6 c0             	movzbl %al,%eax
}
  801bbb:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801bbe:	5b                   	pop    %ebx
  801bbf:	5e                   	pop    %esi
  801bc0:	5f                   	pop    %edi
  801bc1:	5d                   	pop    %ebp
  801bc2:	c3                   	ret    

00801bc3 <devpipe_write>:
{
  801bc3:	f3 0f 1e fb          	endbr32 
  801bc7:	55                   	push   %ebp
  801bc8:	89 e5                	mov    %esp,%ebp
  801bca:	57                   	push   %edi
  801bcb:	56                   	push   %esi
  801bcc:	53                   	push   %ebx
  801bcd:	83 ec 28             	sub    $0x28,%esp
  801bd0:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801bd3:	56                   	push   %esi
  801bd4:	e8 cf f6 ff ff       	call   8012a8 <fd2data>
  801bd9:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801bdb:	83 c4 10             	add    $0x10,%esp
  801bde:	bf 00 00 00 00       	mov    $0x0,%edi
  801be3:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801be6:	74 4f                	je     801c37 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801be8:	8b 43 04             	mov    0x4(%ebx),%eax
  801beb:	8b 0b                	mov    (%ebx),%ecx
  801bed:	8d 51 20             	lea    0x20(%ecx),%edx
  801bf0:	39 d0                	cmp    %edx,%eax
  801bf2:	72 14                	jb     801c08 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801bf4:	89 da                	mov    %ebx,%edx
  801bf6:	89 f0                	mov    %esi,%eax
  801bf8:	e8 61 ff ff ff       	call   801b5e <_pipeisclosed>
  801bfd:	85 c0                	test   %eax,%eax
  801bff:	75 3b                	jne    801c3c <devpipe_write+0x79>
			sys_yield();
  801c01:	e8 19 f1 ff ff       	call   800d1f <sys_yield>
  801c06:	eb e0                	jmp    801be8 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801c08:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801c0b:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801c0f:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801c12:	89 c2                	mov    %eax,%edx
  801c14:	c1 fa 1f             	sar    $0x1f,%edx
  801c17:	89 d1                	mov    %edx,%ecx
  801c19:	c1 e9 1b             	shr    $0x1b,%ecx
  801c1c:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801c1f:	83 e2 1f             	and    $0x1f,%edx
  801c22:	29 ca                	sub    %ecx,%edx
  801c24:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801c28:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801c2c:	83 c0 01             	add    $0x1,%eax
  801c2f:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801c32:	83 c7 01             	add    $0x1,%edi
  801c35:	eb ac                	jmp    801be3 <devpipe_write+0x20>
	return i;
  801c37:	8b 45 10             	mov    0x10(%ebp),%eax
  801c3a:	eb 05                	jmp    801c41 <devpipe_write+0x7e>
				return 0;
  801c3c:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801c41:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c44:	5b                   	pop    %ebx
  801c45:	5e                   	pop    %esi
  801c46:	5f                   	pop    %edi
  801c47:	5d                   	pop    %ebp
  801c48:	c3                   	ret    

00801c49 <devpipe_read>:
{
  801c49:	f3 0f 1e fb          	endbr32 
  801c4d:	55                   	push   %ebp
  801c4e:	89 e5                	mov    %esp,%ebp
  801c50:	57                   	push   %edi
  801c51:	56                   	push   %esi
  801c52:	53                   	push   %ebx
  801c53:	83 ec 18             	sub    $0x18,%esp
  801c56:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801c59:	57                   	push   %edi
  801c5a:	e8 49 f6 ff ff       	call   8012a8 <fd2data>
  801c5f:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801c61:	83 c4 10             	add    $0x10,%esp
  801c64:	be 00 00 00 00       	mov    $0x0,%esi
  801c69:	3b 75 10             	cmp    0x10(%ebp),%esi
  801c6c:	75 14                	jne    801c82 <devpipe_read+0x39>
	return i;
  801c6e:	8b 45 10             	mov    0x10(%ebp),%eax
  801c71:	eb 02                	jmp    801c75 <devpipe_read+0x2c>
				return i;
  801c73:	89 f0                	mov    %esi,%eax
}
  801c75:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c78:	5b                   	pop    %ebx
  801c79:	5e                   	pop    %esi
  801c7a:	5f                   	pop    %edi
  801c7b:	5d                   	pop    %ebp
  801c7c:	c3                   	ret    
			sys_yield();
  801c7d:	e8 9d f0 ff ff       	call   800d1f <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801c82:	8b 03                	mov    (%ebx),%eax
  801c84:	3b 43 04             	cmp    0x4(%ebx),%eax
  801c87:	75 18                	jne    801ca1 <devpipe_read+0x58>
			if (i > 0)
  801c89:	85 f6                	test   %esi,%esi
  801c8b:	75 e6                	jne    801c73 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801c8d:	89 da                	mov    %ebx,%edx
  801c8f:	89 f8                	mov    %edi,%eax
  801c91:	e8 c8 fe ff ff       	call   801b5e <_pipeisclosed>
  801c96:	85 c0                	test   %eax,%eax
  801c98:	74 e3                	je     801c7d <devpipe_read+0x34>
				return 0;
  801c9a:	b8 00 00 00 00       	mov    $0x0,%eax
  801c9f:	eb d4                	jmp    801c75 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801ca1:	99                   	cltd   
  801ca2:	c1 ea 1b             	shr    $0x1b,%edx
  801ca5:	01 d0                	add    %edx,%eax
  801ca7:	83 e0 1f             	and    $0x1f,%eax
  801caa:	29 d0                	sub    %edx,%eax
  801cac:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801cb1:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801cb4:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801cb7:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801cba:	83 c6 01             	add    $0x1,%esi
  801cbd:	eb aa                	jmp    801c69 <devpipe_read+0x20>

00801cbf <pipe>:
{
  801cbf:	f3 0f 1e fb          	endbr32 
  801cc3:	55                   	push   %ebp
  801cc4:	89 e5                	mov    %esp,%ebp
  801cc6:	56                   	push   %esi
  801cc7:	53                   	push   %ebx
  801cc8:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801ccb:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801cce:	50                   	push   %eax
  801ccf:	e8 ef f5 ff ff       	call   8012c3 <fd_alloc>
  801cd4:	89 c3                	mov    %eax,%ebx
  801cd6:	83 c4 10             	add    $0x10,%esp
  801cd9:	85 c0                	test   %eax,%eax
  801cdb:	0f 88 23 01 00 00    	js     801e04 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ce1:	83 ec 04             	sub    $0x4,%esp
  801ce4:	68 07 04 00 00       	push   $0x407
  801ce9:	ff 75 f4             	pushl  -0xc(%ebp)
  801cec:	6a 00                	push   $0x0
  801cee:	e8 4f f0 ff ff       	call   800d42 <sys_page_alloc>
  801cf3:	89 c3                	mov    %eax,%ebx
  801cf5:	83 c4 10             	add    $0x10,%esp
  801cf8:	85 c0                	test   %eax,%eax
  801cfa:	0f 88 04 01 00 00    	js     801e04 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801d00:	83 ec 0c             	sub    $0xc,%esp
  801d03:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801d06:	50                   	push   %eax
  801d07:	e8 b7 f5 ff ff       	call   8012c3 <fd_alloc>
  801d0c:	89 c3                	mov    %eax,%ebx
  801d0e:	83 c4 10             	add    $0x10,%esp
  801d11:	85 c0                	test   %eax,%eax
  801d13:	0f 88 db 00 00 00    	js     801df4 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d19:	83 ec 04             	sub    $0x4,%esp
  801d1c:	68 07 04 00 00       	push   $0x407
  801d21:	ff 75 f0             	pushl  -0x10(%ebp)
  801d24:	6a 00                	push   $0x0
  801d26:	e8 17 f0 ff ff       	call   800d42 <sys_page_alloc>
  801d2b:	89 c3                	mov    %eax,%ebx
  801d2d:	83 c4 10             	add    $0x10,%esp
  801d30:	85 c0                	test   %eax,%eax
  801d32:	0f 88 bc 00 00 00    	js     801df4 <pipe+0x135>
	va = fd2data(fd0);
  801d38:	83 ec 0c             	sub    $0xc,%esp
  801d3b:	ff 75 f4             	pushl  -0xc(%ebp)
  801d3e:	e8 65 f5 ff ff       	call   8012a8 <fd2data>
  801d43:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d45:	83 c4 0c             	add    $0xc,%esp
  801d48:	68 07 04 00 00       	push   $0x407
  801d4d:	50                   	push   %eax
  801d4e:	6a 00                	push   $0x0
  801d50:	e8 ed ef ff ff       	call   800d42 <sys_page_alloc>
  801d55:	89 c3                	mov    %eax,%ebx
  801d57:	83 c4 10             	add    $0x10,%esp
  801d5a:	85 c0                	test   %eax,%eax
  801d5c:	0f 88 82 00 00 00    	js     801de4 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d62:	83 ec 0c             	sub    $0xc,%esp
  801d65:	ff 75 f0             	pushl  -0x10(%ebp)
  801d68:	e8 3b f5 ff ff       	call   8012a8 <fd2data>
  801d6d:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801d74:	50                   	push   %eax
  801d75:	6a 00                	push   $0x0
  801d77:	56                   	push   %esi
  801d78:	6a 00                	push   $0x0
  801d7a:	e8 0a f0 ff ff       	call   800d89 <sys_page_map>
  801d7f:	89 c3                	mov    %eax,%ebx
  801d81:	83 c4 20             	add    $0x20,%esp
  801d84:	85 c0                	test   %eax,%eax
  801d86:	78 4e                	js     801dd6 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801d88:	a1 20 30 80 00       	mov    0x803020,%eax
  801d8d:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d90:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801d92:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d95:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801d9c:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801d9f:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801da1:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801da4:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801dab:	83 ec 0c             	sub    $0xc,%esp
  801dae:	ff 75 f4             	pushl  -0xc(%ebp)
  801db1:	e8 de f4 ff ff       	call   801294 <fd2num>
  801db6:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801db9:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801dbb:	83 c4 04             	add    $0x4,%esp
  801dbe:	ff 75 f0             	pushl  -0x10(%ebp)
  801dc1:	e8 ce f4 ff ff       	call   801294 <fd2num>
  801dc6:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801dc9:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801dcc:	83 c4 10             	add    $0x10,%esp
  801dcf:	bb 00 00 00 00       	mov    $0x0,%ebx
  801dd4:	eb 2e                	jmp    801e04 <pipe+0x145>
	sys_page_unmap(0, va);
  801dd6:	83 ec 08             	sub    $0x8,%esp
  801dd9:	56                   	push   %esi
  801dda:	6a 00                	push   $0x0
  801ddc:	e8 ee ef ff ff       	call   800dcf <sys_page_unmap>
  801de1:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801de4:	83 ec 08             	sub    $0x8,%esp
  801de7:	ff 75 f0             	pushl  -0x10(%ebp)
  801dea:	6a 00                	push   $0x0
  801dec:	e8 de ef ff ff       	call   800dcf <sys_page_unmap>
  801df1:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801df4:	83 ec 08             	sub    $0x8,%esp
  801df7:	ff 75 f4             	pushl  -0xc(%ebp)
  801dfa:	6a 00                	push   $0x0
  801dfc:	e8 ce ef ff ff       	call   800dcf <sys_page_unmap>
  801e01:	83 c4 10             	add    $0x10,%esp
}
  801e04:	89 d8                	mov    %ebx,%eax
  801e06:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801e09:	5b                   	pop    %ebx
  801e0a:	5e                   	pop    %esi
  801e0b:	5d                   	pop    %ebp
  801e0c:	c3                   	ret    

00801e0d <pipeisclosed>:
{
  801e0d:	f3 0f 1e fb          	endbr32 
  801e11:	55                   	push   %ebp
  801e12:	89 e5                	mov    %esp,%ebp
  801e14:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801e17:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e1a:	50                   	push   %eax
  801e1b:	ff 75 08             	pushl  0x8(%ebp)
  801e1e:	e8 f6 f4 ff ff       	call   801319 <fd_lookup>
  801e23:	83 c4 10             	add    $0x10,%esp
  801e26:	85 c0                	test   %eax,%eax
  801e28:	78 18                	js     801e42 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801e2a:	83 ec 0c             	sub    $0xc,%esp
  801e2d:	ff 75 f4             	pushl  -0xc(%ebp)
  801e30:	e8 73 f4 ff ff       	call   8012a8 <fd2data>
  801e35:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801e37:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e3a:	e8 1f fd ff ff       	call   801b5e <_pipeisclosed>
  801e3f:	83 c4 10             	add    $0x10,%esp
}
  801e42:	c9                   	leave  
  801e43:	c3                   	ret    

00801e44 <wait>:
#include <inc/lib.h>

// Waits until 'envid' exits.
void
wait(envid_t envid)
{
  801e44:	f3 0f 1e fb          	endbr32 
  801e48:	55                   	push   %ebp
  801e49:	89 e5                	mov    %esp,%ebp
  801e4b:	56                   	push   %esi
  801e4c:	53                   	push   %ebx
  801e4d:	8b 75 08             	mov    0x8(%ebp),%esi
	const volatile struct Env *e;

	assert(envid != 0);
  801e50:	85 f6                	test   %esi,%esi
  801e52:	74 13                	je     801e67 <wait+0x23>
	e = &envs[ENVX(envid)];
  801e54:	89 f3                	mov    %esi,%ebx
  801e56:	81 e3 ff 03 00 00    	and    $0x3ff,%ebx
	while (e->env_id == envid && e->env_status != ENV_FREE)
  801e5c:	6b db 7c             	imul   $0x7c,%ebx,%ebx
  801e5f:	81 c3 00 00 c0 ee    	add    $0xeec00000,%ebx
  801e65:	eb 1b                	jmp    801e82 <wait+0x3e>
	assert(envid != 0);
  801e67:	68 5a 2b 80 00       	push   $0x802b5a
  801e6c:	68 0f 2b 80 00       	push   $0x802b0f
  801e71:	6a 09                	push   $0x9
  801e73:	68 65 2b 80 00       	push   $0x802b65
  801e78:	e8 c3 e3 ff ff       	call   800240 <_panic>
		sys_yield();
  801e7d:	e8 9d ee ff ff       	call   800d1f <sys_yield>
	while (e->env_id == envid && e->env_status != ENV_FREE)
  801e82:	8b 43 48             	mov    0x48(%ebx),%eax
  801e85:	39 f0                	cmp    %esi,%eax
  801e87:	75 07                	jne    801e90 <wait+0x4c>
  801e89:	8b 43 54             	mov    0x54(%ebx),%eax
  801e8c:	85 c0                	test   %eax,%eax
  801e8e:	75 ed                	jne    801e7d <wait+0x39>
}
  801e90:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801e93:	5b                   	pop    %ebx
  801e94:	5e                   	pop    %esi
  801e95:	5d                   	pop    %ebp
  801e96:	c3                   	ret    

00801e97 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801e97:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801e9b:	b8 00 00 00 00       	mov    $0x0,%eax
  801ea0:	c3                   	ret    

00801ea1 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801ea1:	f3 0f 1e fb          	endbr32 
  801ea5:	55                   	push   %ebp
  801ea6:	89 e5                	mov    %esp,%ebp
  801ea8:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801eab:	68 70 2b 80 00       	push   $0x802b70
  801eb0:	ff 75 0c             	pushl  0xc(%ebp)
  801eb3:	e8 48 ea ff ff       	call   800900 <strcpy>
	return 0;
}
  801eb8:	b8 00 00 00 00       	mov    $0x0,%eax
  801ebd:	c9                   	leave  
  801ebe:	c3                   	ret    

00801ebf <devcons_write>:
{
  801ebf:	f3 0f 1e fb          	endbr32 
  801ec3:	55                   	push   %ebp
  801ec4:	89 e5                	mov    %esp,%ebp
  801ec6:	57                   	push   %edi
  801ec7:	56                   	push   %esi
  801ec8:	53                   	push   %ebx
  801ec9:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801ecf:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801ed4:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801eda:	3b 75 10             	cmp    0x10(%ebp),%esi
  801edd:	73 31                	jae    801f10 <devcons_write+0x51>
		m = n - tot;
  801edf:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801ee2:	29 f3                	sub    %esi,%ebx
  801ee4:	83 fb 7f             	cmp    $0x7f,%ebx
  801ee7:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801eec:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801eef:	83 ec 04             	sub    $0x4,%esp
  801ef2:	53                   	push   %ebx
  801ef3:	89 f0                	mov    %esi,%eax
  801ef5:	03 45 0c             	add    0xc(%ebp),%eax
  801ef8:	50                   	push   %eax
  801ef9:	57                   	push   %edi
  801efa:	e8 b7 eb ff ff       	call   800ab6 <memmove>
		sys_cputs(buf, m);
  801eff:	83 c4 08             	add    $0x8,%esp
  801f02:	53                   	push   %ebx
  801f03:	57                   	push   %edi
  801f04:	e8 69 ed ff ff       	call   800c72 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801f09:	01 de                	add    %ebx,%esi
  801f0b:	83 c4 10             	add    $0x10,%esp
  801f0e:	eb ca                	jmp    801eda <devcons_write+0x1b>
}
  801f10:	89 f0                	mov    %esi,%eax
  801f12:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801f15:	5b                   	pop    %ebx
  801f16:	5e                   	pop    %esi
  801f17:	5f                   	pop    %edi
  801f18:	5d                   	pop    %ebp
  801f19:	c3                   	ret    

00801f1a <devcons_read>:
{
  801f1a:	f3 0f 1e fb          	endbr32 
  801f1e:	55                   	push   %ebp
  801f1f:	89 e5                	mov    %esp,%ebp
  801f21:	83 ec 08             	sub    $0x8,%esp
  801f24:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801f29:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801f2d:	74 21                	je     801f50 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801f2f:	e8 60 ed ff ff       	call   800c94 <sys_cgetc>
  801f34:	85 c0                	test   %eax,%eax
  801f36:	75 07                	jne    801f3f <devcons_read+0x25>
		sys_yield();
  801f38:	e8 e2 ed ff ff       	call   800d1f <sys_yield>
  801f3d:	eb f0                	jmp    801f2f <devcons_read+0x15>
	if (c < 0)
  801f3f:	78 0f                	js     801f50 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801f41:	83 f8 04             	cmp    $0x4,%eax
  801f44:	74 0c                	je     801f52 <devcons_read+0x38>
	*(char*)vbuf = c;
  801f46:	8b 55 0c             	mov    0xc(%ebp),%edx
  801f49:	88 02                	mov    %al,(%edx)
	return 1;
  801f4b:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801f50:	c9                   	leave  
  801f51:	c3                   	ret    
		return 0;
  801f52:	b8 00 00 00 00       	mov    $0x0,%eax
  801f57:	eb f7                	jmp    801f50 <devcons_read+0x36>

00801f59 <cputchar>:
{
  801f59:	f3 0f 1e fb          	endbr32 
  801f5d:	55                   	push   %ebp
  801f5e:	89 e5                	mov    %esp,%ebp
  801f60:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801f63:	8b 45 08             	mov    0x8(%ebp),%eax
  801f66:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801f69:	6a 01                	push   $0x1
  801f6b:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801f6e:	50                   	push   %eax
  801f6f:	e8 fe ec ff ff       	call   800c72 <sys_cputs>
}
  801f74:	83 c4 10             	add    $0x10,%esp
  801f77:	c9                   	leave  
  801f78:	c3                   	ret    

00801f79 <getchar>:
{
  801f79:	f3 0f 1e fb          	endbr32 
  801f7d:	55                   	push   %ebp
  801f7e:	89 e5                	mov    %esp,%ebp
  801f80:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801f83:	6a 01                	push   $0x1
  801f85:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801f88:	50                   	push   %eax
  801f89:	6a 00                	push   $0x0
  801f8b:	e8 0c f6 ff ff       	call   80159c <read>
	if (r < 0)
  801f90:	83 c4 10             	add    $0x10,%esp
  801f93:	85 c0                	test   %eax,%eax
  801f95:	78 06                	js     801f9d <getchar+0x24>
	if (r < 1)
  801f97:	74 06                	je     801f9f <getchar+0x26>
	return c;
  801f99:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801f9d:	c9                   	leave  
  801f9e:	c3                   	ret    
		return -E_EOF;
  801f9f:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801fa4:	eb f7                	jmp    801f9d <getchar+0x24>

00801fa6 <iscons>:
{
  801fa6:	f3 0f 1e fb          	endbr32 
  801faa:	55                   	push   %ebp
  801fab:	89 e5                	mov    %esp,%ebp
  801fad:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801fb0:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801fb3:	50                   	push   %eax
  801fb4:	ff 75 08             	pushl  0x8(%ebp)
  801fb7:	e8 5d f3 ff ff       	call   801319 <fd_lookup>
  801fbc:	83 c4 10             	add    $0x10,%esp
  801fbf:	85 c0                	test   %eax,%eax
  801fc1:	78 11                	js     801fd4 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801fc3:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fc6:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801fcc:	39 10                	cmp    %edx,(%eax)
  801fce:	0f 94 c0             	sete   %al
  801fd1:	0f b6 c0             	movzbl %al,%eax
}
  801fd4:	c9                   	leave  
  801fd5:	c3                   	ret    

00801fd6 <opencons>:
{
  801fd6:	f3 0f 1e fb          	endbr32 
  801fda:	55                   	push   %ebp
  801fdb:	89 e5                	mov    %esp,%ebp
  801fdd:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801fe0:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801fe3:	50                   	push   %eax
  801fe4:	e8 da f2 ff ff       	call   8012c3 <fd_alloc>
  801fe9:	83 c4 10             	add    $0x10,%esp
  801fec:	85 c0                	test   %eax,%eax
  801fee:	78 3a                	js     80202a <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801ff0:	83 ec 04             	sub    $0x4,%esp
  801ff3:	68 07 04 00 00       	push   $0x407
  801ff8:	ff 75 f4             	pushl  -0xc(%ebp)
  801ffb:	6a 00                	push   $0x0
  801ffd:	e8 40 ed ff ff       	call   800d42 <sys_page_alloc>
  802002:	83 c4 10             	add    $0x10,%esp
  802005:	85 c0                	test   %eax,%eax
  802007:	78 21                	js     80202a <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  802009:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80200c:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  802012:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  802014:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802017:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  80201e:	83 ec 0c             	sub    $0xc,%esp
  802021:	50                   	push   %eax
  802022:	e8 6d f2 ff ff       	call   801294 <fd2num>
  802027:	83 c4 10             	add    $0x10,%esp
}
  80202a:	c9                   	leave  
  80202b:	c3                   	ret    

0080202c <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  80202c:	f3 0f 1e fb          	endbr32 
  802030:	55                   	push   %ebp
  802031:	89 e5                	mov    %esp,%ebp
  802033:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  802036:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  80203d:	74 27                	je     802066 <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  80203f:	8b 45 08             	mov    0x8(%ebp),%eax
  802042:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  802047:	a1 20 44 80 00       	mov    0x804420,%eax
  80204c:	8b 40 48             	mov    0x48(%eax),%eax
  80204f:	83 ec 08             	sub    $0x8,%esp
  802052:	68 a6 20 80 00       	push   $0x8020a6
  802057:	50                   	push   %eax
  802058:	e8 44 ee ff ff       	call   800ea1 <sys_env_set_pgfault_upcall>
  80205d:	83 c4 10             	add    $0x10,%esp
  802060:	85 c0                	test   %eax,%eax
  802062:	78 2e                	js     802092 <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  802064:	c9                   	leave  
  802065:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  802066:	83 ec 04             	sub    $0x4,%esp
  802069:	6a 07                	push   $0x7
  80206b:	68 00 f0 bf ee       	push   $0xeebff000
  802070:	6a 00                	push   $0x0
  802072:	e8 cb ec ff ff       	call   800d42 <sys_page_alloc>
  802077:	83 c4 10             	add    $0x10,%esp
  80207a:	85 c0                	test   %eax,%eax
  80207c:	79 c1                	jns    80203f <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  80207e:	83 ec 04             	sub    $0x4,%esp
  802081:	68 7c 2b 80 00       	push   $0x802b7c
  802086:	6a 21                	push   $0x21
  802088:	68 de 2b 80 00       	push   $0x802bde
  80208d:	e8 ae e1 ff ff       	call   800240 <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  802092:	83 ec 04             	sub    $0x4,%esp
  802095:	68 a8 2b 80 00       	push   $0x802ba8
  80209a:	6a 27                	push   $0x27
  80209c:	68 de 2b 80 00       	push   $0x802bde
  8020a1:	e8 9a e1 ff ff       	call   800240 <_panic>

008020a6 <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  8020a6:	54                   	push   %esp
	movl _pgfault_handler, %eax
  8020a7:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  8020ac:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  8020ae:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  8020b1:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  8020b5:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  8020b8:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  8020bc:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  8020c0:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  8020c3:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  8020c6:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  8020c7:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  8020ca:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  8020cb:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  8020cc:	c3                   	ret    

008020cd <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  8020cd:	f3 0f 1e fb          	endbr32 
  8020d1:	55                   	push   %ebp
  8020d2:	89 e5                	mov    %esp,%ebp
  8020d4:	56                   	push   %esi
  8020d5:	53                   	push   %ebx
  8020d6:	8b 75 08             	mov    0x8(%ebp),%esi
  8020d9:	8b 45 0c             	mov    0xc(%ebp),%eax
  8020dc:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  8020df:	85 c0                	test   %eax,%eax
  8020e1:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  8020e6:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  8020e9:	83 ec 0c             	sub    $0xc,%esp
  8020ec:	50                   	push   %eax
  8020ed:	e8 1c ee ff ff       	call   800f0e <sys_ipc_recv>
  8020f2:	83 c4 10             	add    $0x10,%esp
  8020f5:	85 c0                	test   %eax,%eax
  8020f7:	78 3f                	js     802138 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  8020f9:	e8 fe eb ff ff       	call   800cfc <sys_getenvid>
  8020fe:	25 ff 03 00 00       	and    $0x3ff,%eax
  802103:	6b d0 7c             	imul   $0x7c,%eax,%edx
  802106:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  80210c:	89 15 20 44 80 00    	mov    %edx,0x804420

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  802112:	85 f6                	test   %esi,%esi
  802114:	74 05                	je     80211b <ipc_recv+0x4e>
  802116:	8b 42 74             	mov    0x74(%edx),%eax
  802119:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  80211b:	85 db                	test   %ebx,%ebx
  80211d:	74 0a                	je     802129 <ipc_recv+0x5c>
  80211f:	a1 20 44 80 00       	mov    0x804420,%eax
  802124:	8b 40 78             	mov    0x78(%eax),%eax
  802127:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  802129:	a1 20 44 80 00       	mov    0x804420,%eax
  80212e:	8b 40 70             	mov    0x70(%eax),%eax
}
  802131:	8d 65 f8             	lea    -0x8(%ebp),%esp
  802134:	5b                   	pop    %ebx
  802135:	5e                   	pop    %esi
  802136:	5d                   	pop    %ebp
  802137:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  802138:	85 f6                	test   %esi,%esi
  80213a:	74 06                	je     802142 <ipc_recv+0x75>
  80213c:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  802142:	85 db                	test   %ebx,%ebx
  802144:	74 eb                	je     802131 <ipc_recv+0x64>
  802146:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  80214c:	eb e3                	jmp    802131 <ipc_recv+0x64>

0080214e <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  80214e:	f3 0f 1e fb          	endbr32 
  802152:	55                   	push   %ebp
  802153:	89 e5                	mov    %esp,%ebp
  802155:	57                   	push   %edi
  802156:	56                   	push   %esi
  802157:	53                   	push   %ebx
  802158:	83 ec 0c             	sub    $0xc,%esp
  80215b:	8b 7d 08             	mov    0x8(%ebp),%edi
  80215e:	8b 75 0c             	mov    0xc(%ebp),%esi
  802161:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  802164:	85 db                	test   %ebx,%ebx
  802166:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  80216b:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  80216e:	ff 75 14             	pushl  0x14(%ebp)
  802171:	53                   	push   %ebx
  802172:	56                   	push   %esi
  802173:	57                   	push   %edi
  802174:	e8 6e ed ff ff       	call   800ee7 <sys_ipc_try_send>
  802179:	83 c4 10             	add    $0x10,%esp
  80217c:	85 c0                	test   %eax,%eax
  80217e:	79 1e                	jns    80219e <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  802180:	83 f8 f9             	cmp    $0xfffffff9,%eax
  802183:	75 07                	jne    80218c <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  802185:	e8 95 eb ff ff       	call   800d1f <sys_yield>
  80218a:	eb e2                	jmp    80216e <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  80218c:	50                   	push   %eax
  80218d:	68 ec 2b 80 00       	push   $0x802bec
  802192:	6a 3b                	push   $0x3b
  802194:	68 00 2c 80 00       	push   $0x802c00
  802199:	e8 a2 e0 ff ff       	call   800240 <_panic>
	}
}
  80219e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8021a1:	5b                   	pop    %ebx
  8021a2:	5e                   	pop    %esi
  8021a3:	5f                   	pop    %edi
  8021a4:	5d                   	pop    %ebp
  8021a5:	c3                   	ret    

008021a6 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  8021a6:	f3 0f 1e fb          	endbr32 
  8021aa:	55                   	push   %ebp
  8021ab:	89 e5                	mov    %esp,%ebp
  8021ad:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  8021b0:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  8021b5:	6b d0 7c             	imul   $0x7c,%eax,%edx
  8021b8:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  8021be:	8b 52 50             	mov    0x50(%edx),%edx
  8021c1:	39 ca                	cmp    %ecx,%edx
  8021c3:	74 11                	je     8021d6 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  8021c5:	83 c0 01             	add    $0x1,%eax
  8021c8:	3d 00 04 00 00       	cmp    $0x400,%eax
  8021cd:	75 e6                	jne    8021b5 <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  8021cf:	b8 00 00 00 00       	mov    $0x0,%eax
  8021d4:	eb 0b                	jmp    8021e1 <ipc_find_env+0x3b>
			return envs[i].env_id;
  8021d6:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8021d9:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8021de:	8b 40 48             	mov    0x48(%eax),%eax
}
  8021e1:	5d                   	pop    %ebp
  8021e2:	c3                   	ret    

008021e3 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  8021e3:	f3 0f 1e fb          	endbr32 
  8021e7:	55                   	push   %ebp
  8021e8:	89 e5                	mov    %esp,%ebp
  8021ea:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  8021ed:	89 c2                	mov    %eax,%edx
  8021ef:	c1 ea 16             	shr    $0x16,%edx
  8021f2:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  8021f9:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  8021fe:	f6 c1 01             	test   $0x1,%cl
  802201:	74 1c                	je     80221f <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  802203:	c1 e8 0c             	shr    $0xc,%eax
  802206:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  80220d:	a8 01                	test   $0x1,%al
  80220f:	74 0e                	je     80221f <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  802211:	c1 e8 0c             	shr    $0xc,%eax
  802214:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  80221b:	ef 
  80221c:	0f b7 d2             	movzwl %dx,%edx
}
  80221f:	89 d0                	mov    %edx,%eax
  802221:	5d                   	pop    %ebp
  802222:	c3                   	ret    
  802223:	66 90                	xchg   %ax,%ax
  802225:	66 90                	xchg   %ax,%ax
  802227:	66 90                	xchg   %ax,%ax
  802229:	66 90                	xchg   %ax,%ax
  80222b:	66 90                	xchg   %ax,%ax
  80222d:	66 90                	xchg   %ax,%ax
  80222f:	90                   	nop

00802230 <__udivdi3>:
  802230:	f3 0f 1e fb          	endbr32 
  802234:	55                   	push   %ebp
  802235:	57                   	push   %edi
  802236:	56                   	push   %esi
  802237:	53                   	push   %ebx
  802238:	83 ec 1c             	sub    $0x1c,%esp
  80223b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  80223f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  802243:	8b 74 24 34          	mov    0x34(%esp),%esi
  802247:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  80224b:	85 d2                	test   %edx,%edx
  80224d:	75 19                	jne    802268 <__udivdi3+0x38>
  80224f:	39 f3                	cmp    %esi,%ebx
  802251:	76 4d                	jbe    8022a0 <__udivdi3+0x70>
  802253:	31 ff                	xor    %edi,%edi
  802255:	89 e8                	mov    %ebp,%eax
  802257:	89 f2                	mov    %esi,%edx
  802259:	f7 f3                	div    %ebx
  80225b:	89 fa                	mov    %edi,%edx
  80225d:	83 c4 1c             	add    $0x1c,%esp
  802260:	5b                   	pop    %ebx
  802261:	5e                   	pop    %esi
  802262:	5f                   	pop    %edi
  802263:	5d                   	pop    %ebp
  802264:	c3                   	ret    
  802265:	8d 76 00             	lea    0x0(%esi),%esi
  802268:	39 f2                	cmp    %esi,%edx
  80226a:	76 14                	jbe    802280 <__udivdi3+0x50>
  80226c:	31 ff                	xor    %edi,%edi
  80226e:	31 c0                	xor    %eax,%eax
  802270:	89 fa                	mov    %edi,%edx
  802272:	83 c4 1c             	add    $0x1c,%esp
  802275:	5b                   	pop    %ebx
  802276:	5e                   	pop    %esi
  802277:	5f                   	pop    %edi
  802278:	5d                   	pop    %ebp
  802279:	c3                   	ret    
  80227a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802280:	0f bd fa             	bsr    %edx,%edi
  802283:	83 f7 1f             	xor    $0x1f,%edi
  802286:	75 48                	jne    8022d0 <__udivdi3+0xa0>
  802288:	39 f2                	cmp    %esi,%edx
  80228a:	72 06                	jb     802292 <__udivdi3+0x62>
  80228c:	31 c0                	xor    %eax,%eax
  80228e:	39 eb                	cmp    %ebp,%ebx
  802290:	77 de                	ja     802270 <__udivdi3+0x40>
  802292:	b8 01 00 00 00       	mov    $0x1,%eax
  802297:	eb d7                	jmp    802270 <__udivdi3+0x40>
  802299:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8022a0:	89 d9                	mov    %ebx,%ecx
  8022a2:	85 db                	test   %ebx,%ebx
  8022a4:	75 0b                	jne    8022b1 <__udivdi3+0x81>
  8022a6:	b8 01 00 00 00       	mov    $0x1,%eax
  8022ab:	31 d2                	xor    %edx,%edx
  8022ad:	f7 f3                	div    %ebx
  8022af:	89 c1                	mov    %eax,%ecx
  8022b1:	31 d2                	xor    %edx,%edx
  8022b3:	89 f0                	mov    %esi,%eax
  8022b5:	f7 f1                	div    %ecx
  8022b7:	89 c6                	mov    %eax,%esi
  8022b9:	89 e8                	mov    %ebp,%eax
  8022bb:	89 f7                	mov    %esi,%edi
  8022bd:	f7 f1                	div    %ecx
  8022bf:	89 fa                	mov    %edi,%edx
  8022c1:	83 c4 1c             	add    $0x1c,%esp
  8022c4:	5b                   	pop    %ebx
  8022c5:	5e                   	pop    %esi
  8022c6:	5f                   	pop    %edi
  8022c7:	5d                   	pop    %ebp
  8022c8:	c3                   	ret    
  8022c9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8022d0:	89 f9                	mov    %edi,%ecx
  8022d2:	b8 20 00 00 00       	mov    $0x20,%eax
  8022d7:	29 f8                	sub    %edi,%eax
  8022d9:	d3 e2                	shl    %cl,%edx
  8022db:	89 54 24 08          	mov    %edx,0x8(%esp)
  8022df:	89 c1                	mov    %eax,%ecx
  8022e1:	89 da                	mov    %ebx,%edx
  8022e3:	d3 ea                	shr    %cl,%edx
  8022e5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8022e9:	09 d1                	or     %edx,%ecx
  8022eb:	89 f2                	mov    %esi,%edx
  8022ed:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8022f1:	89 f9                	mov    %edi,%ecx
  8022f3:	d3 e3                	shl    %cl,%ebx
  8022f5:	89 c1                	mov    %eax,%ecx
  8022f7:	d3 ea                	shr    %cl,%edx
  8022f9:	89 f9                	mov    %edi,%ecx
  8022fb:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  8022ff:	89 eb                	mov    %ebp,%ebx
  802301:	d3 e6                	shl    %cl,%esi
  802303:	89 c1                	mov    %eax,%ecx
  802305:	d3 eb                	shr    %cl,%ebx
  802307:	09 de                	or     %ebx,%esi
  802309:	89 f0                	mov    %esi,%eax
  80230b:	f7 74 24 08          	divl   0x8(%esp)
  80230f:	89 d6                	mov    %edx,%esi
  802311:	89 c3                	mov    %eax,%ebx
  802313:	f7 64 24 0c          	mull   0xc(%esp)
  802317:	39 d6                	cmp    %edx,%esi
  802319:	72 15                	jb     802330 <__udivdi3+0x100>
  80231b:	89 f9                	mov    %edi,%ecx
  80231d:	d3 e5                	shl    %cl,%ebp
  80231f:	39 c5                	cmp    %eax,%ebp
  802321:	73 04                	jae    802327 <__udivdi3+0xf7>
  802323:	39 d6                	cmp    %edx,%esi
  802325:	74 09                	je     802330 <__udivdi3+0x100>
  802327:	89 d8                	mov    %ebx,%eax
  802329:	31 ff                	xor    %edi,%edi
  80232b:	e9 40 ff ff ff       	jmp    802270 <__udivdi3+0x40>
  802330:	8d 43 ff             	lea    -0x1(%ebx),%eax
  802333:	31 ff                	xor    %edi,%edi
  802335:	e9 36 ff ff ff       	jmp    802270 <__udivdi3+0x40>
  80233a:	66 90                	xchg   %ax,%ax
  80233c:	66 90                	xchg   %ax,%ax
  80233e:	66 90                	xchg   %ax,%ax

00802340 <__umoddi3>:
  802340:	f3 0f 1e fb          	endbr32 
  802344:	55                   	push   %ebp
  802345:	57                   	push   %edi
  802346:	56                   	push   %esi
  802347:	53                   	push   %ebx
  802348:	83 ec 1c             	sub    $0x1c,%esp
  80234b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  80234f:	8b 74 24 30          	mov    0x30(%esp),%esi
  802353:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  802357:	8b 7c 24 38          	mov    0x38(%esp),%edi
  80235b:	85 c0                	test   %eax,%eax
  80235d:	75 19                	jne    802378 <__umoddi3+0x38>
  80235f:	39 df                	cmp    %ebx,%edi
  802361:	76 5d                	jbe    8023c0 <__umoddi3+0x80>
  802363:	89 f0                	mov    %esi,%eax
  802365:	89 da                	mov    %ebx,%edx
  802367:	f7 f7                	div    %edi
  802369:	89 d0                	mov    %edx,%eax
  80236b:	31 d2                	xor    %edx,%edx
  80236d:	83 c4 1c             	add    $0x1c,%esp
  802370:	5b                   	pop    %ebx
  802371:	5e                   	pop    %esi
  802372:	5f                   	pop    %edi
  802373:	5d                   	pop    %ebp
  802374:	c3                   	ret    
  802375:	8d 76 00             	lea    0x0(%esi),%esi
  802378:	89 f2                	mov    %esi,%edx
  80237a:	39 d8                	cmp    %ebx,%eax
  80237c:	76 12                	jbe    802390 <__umoddi3+0x50>
  80237e:	89 f0                	mov    %esi,%eax
  802380:	89 da                	mov    %ebx,%edx
  802382:	83 c4 1c             	add    $0x1c,%esp
  802385:	5b                   	pop    %ebx
  802386:	5e                   	pop    %esi
  802387:	5f                   	pop    %edi
  802388:	5d                   	pop    %ebp
  802389:	c3                   	ret    
  80238a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802390:	0f bd e8             	bsr    %eax,%ebp
  802393:	83 f5 1f             	xor    $0x1f,%ebp
  802396:	75 50                	jne    8023e8 <__umoddi3+0xa8>
  802398:	39 d8                	cmp    %ebx,%eax
  80239a:	0f 82 e0 00 00 00    	jb     802480 <__umoddi3+0x140>
  8023a0:	89 d9                	mov    %ebx,%ecx
  8023a2:	39 f7                	cmp    %esi,%edi
  8023a4:	0f 86 d6 00 00 00    	jbe    802480 <__umoddi3+0x140>
  8023aa:	89 d0                	mov    %edx,%eax
  8023ac:	89 ca                	mov    %ecx,%edx
  8023ae:	83 c4 1c             	add    $0x1c,%esp
  8023b1:	5b                   	pop    %ebx
  8023b2:	5e                   	pop    %esi
  8023b3:	5f                   	pop    %edi
  8023b4:	5d                   	pop    %ebp
  8023b5:	c3                   	ret    
  8023b6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8023bd:	8d 76 00             	lea    0x0(%esi),%esi
  8023c0:	89 fd                	mov    %edi,%ebp
  8023c2:	85 ff                	test   %edi,%edi
  8023c4:	75 0b                	jne    8023d1 <__umoddi3+0x91>
  8023c6:	b8 01 00 00 00       	mov    $0x1,%eax
  8023cb:	31 d2                	xor    %edx,%edx
  8023cd:	f7 f7                	div    %edi
  8023cf:	89 c5                	mov    %eax,%ebp
  8023d1:	89 d8                	mov    %ebx,%eax
  8023d3:	31 d2                	xor    %edx,%edx
  8023d5:	f7 f5                	div    %ebp
  8023d7:	89 f0                	mov    %esi,%eax
  8023d9:	f7 f5                	div    %ebp
  8023db:	89 d0                	mov    %edx,%eax
  8023dd:	31 d2                	xor    %edx,%edx
  8023df:	eb 8c                	jmp    80236d <__umoddi3+0x2d>
  8023e1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8023e8:	89 e9                	mov    %ebp,%ecx
  8023ea:	ba 20 00 00 00       	mov    $0x20,%edx
  8023ef:	29 ea                	sub    %ebp,%edx
  8023f1:	d3 e0                	shl    %cl,%eax
  8023f3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8023f7:	89 d1                	mov    %edx,%ecx
  8023f9:	89 f8                	mov    %edi,%eax
  8023fb:	d3 e8                	shr    %cl,%eax
  8023fd:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802401:	89 54 24 04          	mov    %edx,0x4(%esp)
  802405:	8b 54 24 04          	mov    0x4(%esp),%edx
  802409:	09 c1                	or     %eax,%ecx
  80240b:	89 d8                	mov    %ebx,%eax
  80240d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802411:	89 e9                	mov    %ebp,%ecx
  802413:	d3 e7                	shl    %cl,%edi
  802415:	89 d1                	mov    %edx,%ecx
  802417:	d3 e8                	shr    %cl,%eax
  802419:	89 e9                	mov    %ebp,%ecx
  80241b:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  80241f:	d3 e3                	shl    %cl,%ebx
  802421:	89 c7                	mov    %eax,%edi
  802423:	89 d1                	mov    %edx,%ecx
  802425:	89 f0                	mov    %esi,%eax
  802427:	d3 e8                	shr    %cl,%eax
  802429:	89 e9                	mov    %ebp,%ecx
  80242b:	89 fa                	mov    %edi,%edx
  80242d:	d3 e6                	shl    %cl,%esi
  80242f:	09 d8                	or     %ebx,%eax
  802431:	f7 74 24 08          	divl   0x8(%esp)
  802435:	89 d1                	mov    %edx,%ecx
  802437:	89 f3                	mov    %esi,%ebx
  802439:	f7 64 24 0c          	mull   0xc(%esp)
  80243d:	89 c6                	mov    %eax,%esi
  80243f:	89 d7                	mov    %edx,%edi
  802441:	39 d1                	cmp    %edx,%ecx
  802443:	72 06                	jb     80244b <__umoddi3+0x10b>
  802445:	75 10                	jne    802457 <__umoddi3+0x117>
  802447:	39 c3                	cmp    %eax,%ebx
  802449:	73 0c                	jae    802457 <__umoddi3+0x117>
  80244b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  80244f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  802453:	89 d7                	mov    %edx,%edi
  802455:	89 c6                	mov    %eax,%esi
  802457:	89 ca                	mov    %ecx,%edx
  802459:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  80245e:	29 f3                	sub    %esi,%ebx
  802460:	19 fa                	sbb    %edi,%edx
  802462:	89 d0                	mov    %edx,%eax
  802464:	d3 e0                	shl    %cl,%eax
  802466:	89 e9                	mov    %ebp,%ecx
  802468:	d3 eb                	shr    %cl,%ebx
  80246a:	d3 ea                	shr    %cl,%edx
  80246c:	09 d8                	or     %ebx,%eax
  80246e:	83 c4 1c             	add    $0x1c,%esp
  802471:	5b                   	pop    %ebx
  802472:	5e                   	pop    %esi
  802473:	5f                   	pop    %edi
  802474:	5d                   	pop    %ebp
  802475:	c3                   	ret    
  802476:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80247d:	8d 76 00             	lea    0x0(%esi),%esi
  802480:	29 fe                	sub    %edi,%esi
  802482:	19 c3                	sbb    %eax,%ebx
  802484:	89 f2                	mov    %esi,%edx
  802486:	89 d9                	mov    %ebx,%ecx
  802488:	e9 1d ff ff ff       	jmp    8023aa <__umoddi3+0x6a>
